weeler 1.6.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +2 -10
- data/CHANGELOG.md +12 -0
- data/README.md +9 -21
- data/Rakefile +4 -4
- data/app/assets/javascripts/weeler/init.js +34 -0
- data/app/controllers/weeler/settings_controller.rb +1 -1
- data/app/controllers/weeler/translations_controller.rb +1 -1
- 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/lib/i18n/backend/weeler.rb +1 -1
- data/lib/weeler/action_controller/acts/restful.rb +1 -1
- data/lib/weeler/engine.rb +0 -2
- data/lib/weeler/version.rb +2 -2
- data/spec/controllers/translations_controller_spec.rb +8 -8
- 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.ru +2 -1
- 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/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 +20 -8
- 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/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/spec_helper.rb +6 -4
- data/spec/weeler/action_controller/acts/restful_spec.rb +5 -4
- data/spec/weeler/i18n/backend/weeler_spec.rb +7 -7
- data/spec/weeler/i18n/humanize_missing_translations_spec.rb +14 -11
- data/weeler.gemspec +17 -12
- metadata +97 -58
- data/app/assets/javascripts/weeler/init.js.coffee +0 -26
- 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/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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f2174e5387e4473742f03bcb7d8676524c0909bf8ad711bb4a61b722c1d75834
|
4
|
+
data.tar.gz: 3c4250a6a160bf9cb62da039fc29e8d372d968ad05e02400ee1162bad4f61327
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '05382816c8433c45a716d23bccf68821c1d7872fb464ed353b291e0873e90cd6a5ee2be5a011112ed7674be33c205772de5849b3d72c095e626ebd924ee0b5d3'
|
7
|
+
data.tar.gz: 8ad0ed75b237f4bf39bbc47eaa4189100f9f6db5ee02342cf81fcbe8eafd52f70feeba24cb2ce45026f61f42f939eea66f231a88a72a882b3a18e840017eda82
|
data/.travis.yml
CHANGED
@@ -7,16 +7,8 @@ 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
|
-
- "2.2.4"
|
13
|
-
- "2.2.5"
|
14
|
-
- "2.2.6"
|
15
|
-
- "2.3.0"
|
16
|
-
- "2.3.1"
|
17
|
-
- "2.3.2"
|
18
|
-
- "2.3.3"
|
19
|
-
- "2.4.0"
|
10
|
+
- "2.6.0"
|
11
|
+
- "2.7.0"
|
20
12
|
# uncomment this line if your project needs to run something other than `rake`:
|
21
13
|
script:
|
22
14
|
- RAILS_ENV=test bundle exec rake db:migrate --trace
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -7,12 +7,20 @@
|
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
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
|
+
|
10
18
|
### Rails 5.0
|
11
19
|
|
12
20
|
1.6.0 version only supports Rails 5.0 and ruby 2.2.2 and higher version. In Gemfile include:
|
13
21
|
|
14
22
|
```ruby
|
15
|
-
gem 'weeler'
|
23
|
+
gem 'weeler', '~> 1.6'
|
16
24
|
```
|
17
25
|
|
18
26
|
### Rails 4.2
|
@@ -155,26 +163,6 @@ Also you can override all standart restful action view and implement, if you nee
|
|
155
163
|
|
156
164
|
Weeler have default views for index, new, edit actions. You should override <tt>_form.html.haml</tt> partial.
|
157
165
|
|
158
|
-
### View helper image_upload_field :
|
159
|
-
|
160
|
-
Weeler action view helper method.
|
161
|
-
It creates file upload field with info and preview for image.
|
162
|
-
|
163
|
-
e.g.
|
164
|
-
|
165
|
-
<%= f.image_upload_field :image, size_info: "270x294" %>
|
166
|
-
|
167
|
-
It creates:
|
168
|
-
|
169
|
-
<div class="col-lg-10 col-md-10">
|
170
|
-
<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>
|
171
|
-
</div>
|
172
|
-
|
173
|
-
If you use another image handler than Paperclip, you can also pass <tt>image_url_method</tt> for image preview.
|
174
|
-
|
175
|
-
Also with remove_image action in controller and route for that,
|
176
|
-
it removes only image from object.
|
177
|
-
|
178
166
|
## Contributing
|
179
167
|
|
180
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,34 @@
|
|
1
|
+
//= require jquery
|
2
|
+
//= require jquery.turbolinks
|
3
|
+
//= require jquery-ui
|
4
|
+
//= require jquery_ujs
|
5
|
+
//= require turbolinks
|
6
|
+
//= require ./vendor/moment
|
7
|
+
//= require_tree ./vendor
|
8
|
+
//= require_tree ./lib
|
9
|
+
//= require weeler/app
|
10
|
+
//= require_self
|
11
|
+
|
12
|
+
(function() {
|
13
|
+
var app;
|
14
|
+
|
15
|
+
app = {
|
16
|
+
boot: function() {
|
17
|
+
$('.weeler-file-inputs').bootstrapFileInput();
|
18
|
+
sortable.init();
|
19
|
+
flash.init();
|
20
|
+
$('[data-provide="rowlink"],[data-provides="rowlink"]').each(function() {
|
21
|
+
return $(this).rowlink($(this).data());
|
22
|
+
});
|
23
|
+
$('.datepicker').datetimepicker({
|
24
|
+
format: 'DD/MM/YYYY'
|
25
|
+
});
|
26
|
+
return $('.datetimepicker').datetimepicker();
|
27
|
+
}
|
28
|
+
};
|
29
|
+
|
30
|
+
$(document).ready(function() {
|
31
|
+
return app.boot();
|
32
|
+
});
|
33
|
+
|
34
|
+
}).call(this);
|
@@ -6,7 +6,7 @@ class Weeler::SettingsController < Weeler::ConfigurationController
|
|
6
6
|
|
7
7
|
def update
|
8
8
|
@setting = Settings.unscoped.find(params[:id])
|
9
|
-
if @setting.
|
9
|
+
if @setting.update(setting_params)
|
10
10
|
redirect_to weeler_settings_path, flash: {success: "Setting updated."}
|
11
11
|
else
|
12
12
|
flash.now[:error] = "Errors in updating."
|
@@ -30,7 +30,7 @@ module Weeler
|
|
30
30
|
def update
|
31
31
|
@translation = I18n::Backend::Weeler::Translation.find(params[:id])
|
32
32
|
|
33
|
-
if @translation.
|
33
|
+
if @translation.update(translation_params)
|
34
34
|
Settings.i18n_updated_at = Time.now
|
35
35
|
|
36
36
|
redirect_to ({ action: :edit, id: @translation }), flash: { success: "Translation updated." }
|
@@ -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?
|
data/lib/i18n/backend/weeler.rb
CHANGED
@@ -118,7 +118,7 @@ module I18n
|
|
118
118
|
translation = result.first
|
119
119
|
if translation.value.blank?
|
120
120
|
fallback_value = fallback_backend_translation locale, key
|
121
|
-
translation.
|
121
|
+
translation.update value: fallback_value if fallback_value.present?
|
122
122
|
end
|
123
123
|
return translation.value
|
124
124
|
else
|
data/lib/weeler/engine.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require "weeler/action_controller/acts/restful"
|
2
2
|
require "weeler/action_dispatch/routing/mapper"
|
3
|
-
require "weeler/action_view/helpers/form_helper"
|
4
3
|
require "weeler/action_view/helpers/translation_helper"
|
5
4
|
|
6
5
|
module Weeler
|
@@ -16,7 +15,6 @@ module Weeler
|
|
16
15
|
::ActionDispatch::Routing::Mapper.send(:include, Weeler::ActionDispatch::Routing::Mapper)
|
17
16
|
::ActionController::Base.send(:include, Weeler::ActionController::Acts::Restful)
|
18
17
|
|
19
|
-
::ActionView::Helpers::FormBuilder.send(:include, Weeler::ActionView::Helpers::FormHelper)
|
20
18
|
::ActionView::Base.send(:include, Weeler::ActionView::Helpers::TranslationHelper)
|
21
19
|
end
|
22
20
|
|
data/lib/weeler/version.rb
CHANGED
@@ -10,8 +10,8 @@ describe Weeler::TranslationsController, type: :controller do
|
|
10
10
|
|
11
11
|
describe "GET #index" do
|
12
12
|
before do
|
13
|
-
|
14
|
-
|
13
|
+
FactoryBot.create(:translation, key: 'foo.bar')
|
14
|
+
FactoryBot.create(:translation, key: 'bar.foo')
|
15
15
|
end
|
16
16
|
|
17
17
|
it "list translations" do
|
@@ -25,7 +25,7 @@ describe Weeler::TranslationsController, type: :controller do
|
|
25
25
|
expect(I18n.t("title", locale: :en)).to eq("Title")
|
26
26
|
I18n::Backend::Weeler::Translation.delete_all
|
27
27
|
|
28
|
-
post :create, params: { i18n_backend_weeler_translation:
|
28
|
+
post :create, params: { i18n_backend_weeler_translation: FactoryBot.attributes_for(:translation) }
|
29
29
|
|
30
30
|
expect(I18n.t("title", locale: :en)).to eq("This is weeler")
|
31
31
|
end
|
@@ -44,7 +44,7 @@ describe Weeler::TranslationsController, type: :controller do
|
|
44
44
|
describe "PUT #update" do
|
45
45
|
it "update translation in DB" do
|
46
46
|
I18n::Backend::Weeler::Translation.delete_all
|
47
|
-
translation =
|
47
|
+
translation = FactoryBot.create(:translation, key: 'foo.updated', value: nil)
|
48
48
|
|
49
49
|
put "update", params: { id: translation.id, i18n_backend_weeler_translation: {value: "Updated weeler!"} }
|
50
50
|
expect(I18n.t("foo.updated", locale: :en)).to eq("Updated weeler!")
|
@@ -52,7 +52,7 @@ describe Weeler::TranslationsController, type: :controller do
|
|
52
52
|
|
53
53
|
it "dont updates if key is empty" do
|
54
54
|
I18n::Backend::Weeler::Translation.delete_all
|
55
|
-
translation =
|
55
|
+
translation = FactoryBot.create(:translation, key: 'foo.updated', value: nil)
|
56
56
|
|
57
57
|
put "update", params: { id: translation.id, i18n_backend_weeler_translation: {value: "Updated weeler!", key: nil} }
|
58
58
|
expect(response).to render_template(:edit)
|
@@ -68,7 +68,7 @@ describe Weeler::TranslationsController, type: :controller do
|
|
68
68
|
|
69
69
|
describe "GET #edit" do
|
70
70
|
it "retern edit translation form" do
|
71
|
-
translation =
|
71
|
+
translation = FactoryBot.create(:translation, key: 'foo.updated', value: nil)
|
72
72
|
get "edit", params: { id: translation.id }
|
73
73
|
expect(response).to render_template(:edit)
|
74
74
|
end
|
@@ -76,7 +76,7 @@ describe Weeler::TranslationsController, type: :controller do
|
|
76
76
|
|
77
77
|
describe "DELETE #destroy" do
|
78
78
|
it "destroys translation" do
|
79
|
-
translation =
|
79
|
+
translation = FactoryBot.create(:translation, key: 'foo.removing', value: "Bla bla")
|
80
80
|
delete "destroy", params: { id: translation.id }
|
81
81
|
|
82
82
|
expect(I18n.t("foo.removing", locale: :en)).to eq("Removing") # Returns empty key
|
@@ -110,7 +110,7 @@ describe Weeler::TranslationsController, type: :controller do
|
|
110
110
|
it "retursns translation file" do
|
111
111
|
get "export", format: :xlsx
|
112
112
|
expect(response.headers["Content-Type"]).to eq("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
113
|
-
expect(response.headers["Content-Disposition"]).to eq("attachment; filename=\"translations.xlsx\"")
|
113
|
+
expect(response.headers["Content-Disposition"]).to eq("attachment; filename=\"translations.xlsx\"; filename*=UTF-8''translations.xlsx")
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.7.0
|
data/spec/dummy/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
2
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
3
|
|
4
|
-
|
4
|
+
require_relative 'config/application'
|
5
5
|
|
6
|
-
|
6
|
+
Rails.application.load_tasks
|
@@ -3,11 +3,13 @@
|
|
3
3
|
* listed below.
|
4
4
|
*
|
5
5
|
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or vendor/assets/stylesheets
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
7
|
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the
|
9
|
-
* compiled file
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
10
12
|
*
|
11
|
-
*= require_self
|
12
13
|
*= require_tree .
|
14
|
+
*= require_self
|
13
15
|
*/
|
@@ -2,12 +2,14 @@
|
|
2
2
|
// listed below.
|
3
3
|
//
|
4
4
|
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or vendor/assets/javascripts
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
6
|
//
|
7
7
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// compiled file.
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
9
|
//
|
10
|
-
// Read Sprockets README (https://github.com/
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
11
|
// about supported directives.
|
12
12
|
//
|
13
|
+
//= require rails-ujs
|
14
|
+
//= require activestorage
|
13
15
|
//= require_tree .
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class ApplicationJob < ActiveJob::Base
|
2
|
+
# Automatically retry jobs that encountered a deadlock
|
3
|
+
# retry_on ActiveRecord::Deadlocked
|
4
|
+
|
5
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
6
|
+
# discard_on ActiveJob::DeserializationError
|
7
|
+
end
|
@@ -3,7 +3,7 @@ class Post < ActiveRecord::Base
|
|
3
3
|
has_many :translations
|
4
4
|
accepts_nested_attributes_for :translations, :allow_destroy => true
|
5
5
|
|
6
|
-
|
6
|
+
Image = Struct.new(:url) do
|
7
7
|
def url(type = nil)
|
8
8
|
type = "original" if type.blank?
|
9
9
|
Rails.root.join("sample/#{type.to_s}.png")
|
@@ -1,14 +1,14 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
10
7
|
|
11
|
-
<%=
|
8
|
+
<%= stylesheet_link_tag 'application', media: 'all' %>
|
9
|
+
</head>
|
12
10
|
|
13
|
-
|
11
|
+
<body>
|
12
|
+
<%= yield %>
|
13
|
+
</body>
|
14
14
|
</html>
|