weeler 1.6.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +2 -10
  3. data/CHANGELOG.md +12 -0
  4. data/README.md +9 -21
  5. data/Rakefile +4 -4
  6. data/app/assets/javascripts/weeler/init.js +34 -0
  7. data/app/controllers/weeler/settings_controller.rb +1 -1
  8. data/app/controllers/weeler/translations_controller.rb +1 -1
  9. data/app/views/kaminari/weeler/_first_page.html.haml +3 -0
  10. data/app/views/kaminari/weeler/_gap.html.haml +2 -0
  11. data/app/views/kaminari/weeler/_last_page.html.haml +3 -0
  12. data/app/views/kaminari/weeler/_next_page.html.haml +3 -0
  13. data/app/views/kaminari/weeler/_page.html.haml +2 -0
  14. data/app/views/kaminari/weeler/_paginator.html.haml +11 -0
  15. data/app/views/kaminari/weeler/_prev_page.html.haml +3 -0
  16. data/lib/i18n/backend/weeler.rb +1 -1
  17. data/lib/weeler/action_controller/acts/restful.rb +1 -1
  18. data/lib/weeler/engine.rb +0 -2
  19. data/lib/weeler/version.rb +2 -2
  20. data/spec/controllers/translations_controller_spec.rb +8 -8
  21. data/spec/dummy/.ruby-version +1 -0
  22. data/spec/dummy/Rakefile +2 -2
  23. data/spec/dummy/app/assets/config/manifest.js +3 -0
  24. data/spec/dummy/app/assets/stylesheets/application.css +6 -4
  25. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  26. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  27. data/spec/dummy/app/controllers/application_controller.rb +0 -3
  28. data/spec/dummy/app/{assets/javascripts → javascript/packs}/application.js +5 -3
  29. data/spec/dummy/app/jobs/application_job.rb +7 -0
  30. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  31. data/spec/dummy/app/models/application_record.rb +3 -0
  32. data/spec/dummy/app/models/post.rb +1 -1
  33. data/spec/dummy/app/views/layouts/application.html.erb +9 -9
  34. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  35. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  36. data/spec/dummy/bin/rails +1 -1
  37. data/spec/dummy/bin/setup +33 -0
  38. data/spec/dummy/config.ru +2 -1
  39. data/spec/dummy/config/application.rb +19 -13
  40. data/spec/dummy/config/boot.rb +3 -3
  41. data/spec/dummy/config/cable.yml +10 -0
  42. data/spec/dummy/config/environment.rb +2 -2
  43. data/spec/dummy/config/environments/development.rb +38 -5
  44. data/spec/dummy/config/environments/production.rb +64 -32
  45. data/spec/dummy/config/environments/test.rb +20 -8
  46. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  47. data/spec/dummy/config/initializers/assets.rb +12 -0
  48. data/spec/dummy/config/initializers/content_security_policy.rb +28 -0
  49. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  50. data/spec/dummy/config/initializers/mime_types.rb +0 -1
  51. data/spec/dummy/config/initializers/wrap_parameters.rb +2 -2
  52. data/spec/dummy/config/puma.rb +38 -0
  53. data/spec/dummy/config/spring.rb +6 -0
  54. data/spec/dummy/config/storage.yml +34 -0
  55. data/spec/dummy/db/migrate/20140123083704_create_weeler_seos.rb +1 -1
  56. data/spec/dummy/db/migrate/20140123083705_create_weeler_settings.rb +1 -1
  57. data/spec/dummy/db/migrate/20140123083706_create_weeler_translations.rb +1 -1
  58. data/spec/dummy/db/migrate/20140123083707_translate_weeler_seos.rb +1 -1
  59. data/spec/dummy/db/migrate/20140718103237_create_posts.rb +1 -1
  60. data/spec/dummy/db/migrate/20140726151210_create_translations.rb +1 -1
  61. data/spec/dummy/db/migrate/20160330161101_create_weeler_locks.rb +1 -1
  62. data/spec/dummy/db/migrate/20160330192005_create_weeler_translation_stats.rb +1 -1
  63. data/spec/dummy/db/schema.rb +56 -64
  64. data/spec/dummy/{app/mailers/.keep → db/test.sqlite3} +0 -0
  65. data/spec/dummy/log/development.log +0 -1020
  66. data/spec/dummy/public/404.html +24 -15
  67. data/spec/dummy/public/422.html +24 -15
  68. data/spec/dummy/public/500.html +23 -14
  69. data/spec/dummy/{app/models/.keep → public/apple-touch-icon-precomposed.png} +0 -0
  70. data/spec/dummy/public/apple-touch-icon.png +0 -0
  71. data/spec/dummy/storage/.keep +0 -0
  72. data/spec/factories/dummy_posts.rb +3 -3
  73. data/spec/factories/translations.rb +4 -4
  74. data/spec/spec_helper.rb +6 -4
  75. data/spec/weeler/action_controller/acts/restful_spec.rb +5 -4
  76. data/spec/weeler/i18n/backend/weeler_spec.rb +7 -7
  77. data/spec/weeler/i18n/humanize_missing_translations_spec.rb +14 -11
  78. data/weeler.gemspec +17 -12
  79. metadata +97 -58
  80. data/app/assets/javascripts/weeler/init.js.coffee +0 -26
  81. data/app/views/kaminari/weeler/_first_page.html.erb +0 -13
  82. data/app/views/kaminari/weeler/_gap.html.erb +0 -8
  83. data/app/views/kaminari/weeler/_last_page.html.erb +0 -13
  84. data/app/views/kaminari/weeler/_next_page.html.erb +0 -14
  85. data/app/views/kaminari/weeler/_page.html.erb +0 -12
  86. data/app/views/kaminari/weeler/_paginator.html.erb +0 -23
  87. data/app/views/kaminari/weeler/_prev_page.html.erb +0 -13
  88. data/lib/weeler/action_view/helpers/form_helper.rb +0 -13
  89. data/lib/weeler/action_view/helpers/image_form_helper.rb +0 -83
  90. data/spec/dummy/README.rdoc +0 -28
  91. data/spec/dummy/bin/bundle +0 -3
  92. data/spec/dummy/config/initializers/secret_token.rb +0 -12
  93. data/spec/dummy/config/initializers/session_store.rb +0 -3
  94. data/spec/dummy/log/production.log +0 -4
  95. data/spec/weeler/action_view/helpers/form_helper_spec.rb +0 -35
@@ -1,13 +0,0 @@
1
- <%# Link to the "First" page
2
- - available local variables
3
- url: url to the first page
4
- current_page: a page object for the currently displayed page
5
- total_pages: total number of pages
6
- per_page: number of items to fetch per page
7
- remote: data-remote
8
- -%>
9
- <% unless current_page.first? -%>
10
- <li class="first">
11
- <%= link_to "<<", url, {:remote => remote} %>
12
- </li>
13
- <% end -%>
@@ -1,8 +0,0 @@
1
- <%# Non-link tag that stands for skipped pages...
2
- - available local variables
3
- current_page: a page object for the currently displayed page
4
- total_pages: total number of pages
5
- per_page: number of items to fetch per page
6
- remote: data-remote
7
- -%>
8
- <li class="page gap disabled"><a href="javascript:void(0)">...</a></li>
@@ -1,13 +0,0 @@
1
- <%# Link to the "Last" page
2
- - available local variables
3
- url: url to the last page
4
- current_page: a page object for the currently displayed page
5
- total_pages: total number of pages
6
- per_page: number of items to fetch per page
7
- remote: data-remote
8
- -%>
9
- <% unless current_page.last? -%>
10
- <li class="last">
11
- <%= link_to ">>", url, {:remote => remote} %>
12
- </li>
13
- <% end -%>
@@ -1,14 +0,0 @@
1
- <%# Link to the "Next" page
2
- - available local variables
3
- url: url to the next page
4
- current_page: a page object for the currently displayed page
5
- total_pages: total number of pages
6
- per_page: number of items to fetch per page
7
- remote: data-remote
8
- -%>
9
-
10
- <% unless current_page.last? -%>
11
- <li class="next">
12
- <%= link_to ">", url, :remote => remote, :rel => 'next' %>
13
- </li>
14
- <% end -%>
@@ -1,12 +0,0 @@
1
- <%# Link showing page number
2
- - available local variables
3
- page: a page object for "this" page
4
- url: url to this page
5
- current_page: a page object for the currently displayed page
6
- total_pages: total number of pages
7
- per_page: number of items to fetch per page
8
- remote: data-remote
9
- -%>
10
- <li class="page<%= ' active' if page.current? %>">
11
- <%= link_to page, (page.current? ? 'javascript:void(0)' : url), opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
12
- </li>
@@ -1,23 +0,0 @@
1
- <%# The container tag
2
- - available local variables
3
- current_page: a page object for the currently displayed page
4
- total_pages: total number of pages
5
- per_page: number of items to fetch per page
6
- remote: data-remote
7
- paginator: the paginator that renders the pagination tags inside
8
- -%>
9
- <%= paginator.render do -%>
10
- <ul class="pagination pagination-lg col-lg-12 col-md-12">
11
- <%= first_page_tag unless current_page.first? %>
12
- <%= prev_page_tag unless current_page.first? %>
13
- <% each_page do |page| -%>
14
- <% if page.left_outer? || page.right_outer? || page.inside_window? -%>
15
- <%= page_tag page %>
16
- <% elsif !page.was_truncated? -%>
17
- <%= gap_tag %>
18
- <% end -%>
19
- <% end -%>
20
- <%= next_page_tag unless current_page.last? %>
21
- <%= last_page_tag unless current_page.last? %>
22
- </ul>
23
- <% end -%>
@@ -1,13 +0,0 @@
1
- <%# Link to the "Previous" page
2
- - available local variables
3
- url: url to the previous page
4
- current_page: a page object for the currently displayed page
5
- total_pages: total number of pages
6
- per_page: number of items to fetch per page
7
- remote: data-remote
8
- -%>
9
- <% unless current_page.first? -%>
10
- <li class="prev">
11
- <%= link_to "<", url, :remote => remote, :rel => 'prev' %>
12
- </li>
13
- <% end -%>
@@ -1,13 +0,0 @@
1
- require "weeler/action_view/helpers/image_form_helper"
2
-
3
- module Weeler
4
- module ActionView
5
- module Helpers
6
- module FormHelper
7
- extend ActiveSupport::Concern
8
-
9
- include ImageFormHelper
10
- end
11
- end
12
- end
13
- end
@@ -1,83 +0,0 @@
1
- module Weeler
2
- module ActionView
3
- module Helpers
4
- module ImageFormHelper
5
-
6
- # Weeler action view helper method.
7
- # It creates file upload field with info and preview for image.
8
- #
9
- # e.g.
10
- #
11
- # <%= f.image_upload_field :image, size_info: "270x294" %>
12
- #
13
- # It creates:
14
- # <div class="col-lg-10 col-md-10">
15
- # <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>
16
- # </div>
17
- #
18
- # If you use another image handler than Paperclip, you can also pass <tt>image_url_method</tt> for image preview.
19
- #
20
- # Also with remove_image action in controller and route for that,
21
- # it removes only image from object.
22
- def image_upload_field(name, options = {})
23
- options = options.reverse_merge({size_info: "200x80", image_url_method: "#{name.to_s}.url(\"original\")"})
24
- self.multipart = true
25
-
26
- buffer = @template.label(@object_name, name, :class => "col-lg-2 col-md-2 control-label")
27
-
28
- buffer += image_upload_field_file_block name, options[:size_info]
29
- buffer += image_upload_field_preview_block name, options[:image_url_method] if File.exist?(@object.instance_eval(options[:image_url_method]))
30
-
31
- buffer
32
- end
33
-
34
- private
35
-
36
- def image_upload_field_file_block name, size_info
37
- @template.content_tag :div, :class => "col-lg-5 col-md-5" do
38
- sub_buffer = @template.content_tag :div, :class => "row" do
39
- @template.content_tag :div, :class => "col-lg-12 col-md-12" do
40
- @template.file_field @object_name, name, :class => 'form-control'
41
- end
42
- end
43
- sub_buffer += @template.content_tag :div, :class => "row" do
44
- @template.content_tag :div, :class => "col-lg-12 col-md-12" do
45
- "Size should be #{size_info}"
46
- end
47
- end
48
- sub_buffer
49
- end
50
- end
51
-
52
- def image_upload_field_preview_block name, image_url_method
53
- @template.content_tag :div, :class => "col-lg-5 col-md-5" do
54
- if @object.instance_eval(name.to_s).present?
55
- sub_buffer = @template.content_tag :div, :class => "row" do
56
- @template.content_tag :div, :class => "col-lg-12 col-md-12" do
57
- @template.image_tag @object.instance_eval(image_url_method), :style => "height: 80px;"
58
- end
59
- end
60
-
61
- build_route = true
62
- begin
63
- @template.link_to("Remove", action: "remove_image")
64
- rescue Exception
65
- build_route = false
66
- end
67
-
68
- if build_route
69
- sub_buffer += @template.content_tag :div, :class => "row" do
70
- @template.content_tag :div, :class => "col-lg-12 col-md-12" do
71
- @template.link_to("Remove", :action => "remove_image")
72
- end
73
- end
74
- end
75
- sub_buffer
76
- end
77
- end
78
- end
79
-
80
- end
81
- end
82
- end
83
- end
@@ -1,28 +0,0 @@
1
- == README
2
-
3
- This README would normally document whatever steps are necessary to get the
4
- application up and running.
5
-
6
- Things you may want to cover:
7
-
8
- * Ruby version
9
-
10
- * System dependencies
11
-
12
- * Configuration
13
-
14
- * Database creation
15
-
16
- * Database initialization
17
-
18
- * How to run the test suite
19
-
20
- * Services (job queues, cache servers, search engines, etc.)
21
-
22
- * Deployment instructions
23
-
24
- * ...
25
-
26
-
27
- Please feel free to use a different markup language if you do not plan to run
28
- <tt>rake doc:app</tt>.
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
@@ -1,12 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key is used for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
-
6
- # Make sure the secret is at least 30 characters and all random,
7
- # no regular words or you'll be exposed to dictionary attacks.
8
- # You can use `rake secret` to generate a secure secret key.
9
-
10
- # Make sure your secret_key_base is kept private
11
- # if you're sharing your code publicly.
12
- Dummy::Application.config.secret_key_base = '7e45902aea275fe812fcfdbd74ac9ee11e5198015745c89ececd1cf4cdcbd680c3acc78c47656f0e70034acf0bf08b0877e633bdcf4e8f4f7389da5922011f45'
@@ -1,3 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
@@ -1,4 +0,0 @@
1
- E, [2013-10-17T10:41:04.917821 #2089] ERROR -- : SQLite3::SQLException: no such table: weeler_translations: SELECT "weeler_translations".* FROM "weeler_translations" WHERE "weeler_translations"."locale" = 'en' AND ("key" IN ('some.missing translation') OR "key" LIKE 'some.missing translation.%')
2
- E, [2013-10-17T10:41:04.924139 #2089] ERROR -- : SQLite3::SQLException: no such table: weeler_translations: SELECT "weeler_translations".* FROM "weeler_translations" WHERE "weeler_translations"."locale" = 'en' AND ("key" IN ('i18n.transliterate.rule') OR "key" LIKE 'i18n.transliterate.rule.%')
3
- E, [2013-10-17T10:41:04.930056 #2089] ERROR -- : SQLite3::SQLException: no such table: weeler_translations: SELECT "weeler_translations".* FROM "weeler_translations" WHERE "weeler_translations"."locale" = 'en' AND ("key" IN ('hello') OR "key" LIKE 'hello.%')
4
- I, [2013-10-17T10:42:06.994964 #2101] INFO -- : Migrating to CreateWeelerTranslations (20131015144900)
@@ -1,35 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Weeler::ActionView::Helpers::FormHelper, :type => :helper do
4
-
5
- let(:resource) { FactoryGirl.create :dummy_post }
6
- let(:helper) { ActionView::Helpers::FormBuilder.new(:post, resource, self, {})}
7
-
8
- let(:output) {
9
- helper.image_upload_field :image
10
- }
11
-
12
- it 'create file field' do
13
- expect(output).to include 'type="file"'
14
- expect(output).to include 'name="post[image]"'
15
- end
16
-
17
- it 'creates a label' do
18
- expect(output).to include '<label'
19
- end
20
-
21
- it "creates img preview tag" do
22
- expect(output).to include '<img'
23
- expect(output).to include 'src="'+ Rails.root.join('sample/original.png').to_s+'"'
24
- expect(output).to include 'style="height: 80px;"'
25
- end
26
-
27
- context 'change size info and image url method' do
28
-
29
- it 'works on none java platforms' do
30
- expect(helper.image_upload_field(:image, image_url_method: "image.url('small')", size_info: "200x100")).to include("200x100")
31
- end
32
-
33
- end
34
-
35
- end