phrasing 4.0.0rc16 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -2
  3. data/CHANGELOG.md +37 -0
  4. data/Gemfile +1 -0
  5. data/MIT-LICENSE +0 -0
  6. data/README.md +2 -8
  7. data/Rakefile +0 -0
  8. data/app/assets/fonts/icomoon.dev.svg +0 -0
  9. data/app/assets/fonts/icomoon.eot +0 -0
  10. data/app/assets/fonts/icomoon.svg +0 -0
  11. data/app/assets/fonts/icomoon.ttf +0 -0
  12. data/app/assets/fonts/icomoon.woff +0 -0
  13. data/app/assets/images/phrasing_icon_edit_all.png +0 -0
  14. data/app/assets/javascripts/phrasing_engine.js +0 -0
  15. data/app/assets/stylesheets/phrasing_engine.css +0 -0
  16. data/app/controllers/phrasing_phrases_controller.rb +6 -2
  17. data/app/models/phrasing_phrase_version.rb +0 -0
  18. data/app/views/layouts/phrasing.html.haml +0 -0
  19. data/app/views/phrasing/_initializer.html.haml +0 -0
  20. data/app/views/phrasing/_menu.html.haml +0 -0
  21. data/app/views/phrasing/_messages.html.haml +0 -0
  22. data/app/views/phrasing_phrases/edit.html.haml +0 -0
  23. data/app/views/phrasing_phrases/help.html.haml +0 -0
  24. data/app/views/phrasing_phrases/index.html.haml +2 -0
  25. data/lib/phrasing/serializer.rb +6 -6
  26. data/lib/phrasing/version.rb +1 -1
  27. data/spec/dummy/Rakefile +0 -0
  28. data/spec/dummy/app/controllers/application_controller.rb +0 -0
  29. data/spec/dummy/app/helpers/application_helper.rb +0 -0
  30. data/spec/dummy/app/helpers/phrasing_helper.rb +0 -0
  31. data/spec/dummy/app/models/.gitkeep +0 -0
  32. data/spec/dummy/app/views/layouts/application.html.erb +0 -0
  33. data/spec/dummy/config.ru +0 -0
  34. data/spec/dummy/config/application.rb +0 -0
  35. data/spec/dummy/config/boot.rb +0 -0
  36. data/spec/dummy/config/database.yml +0 -0
  37. data/spec/dummy/config/environment.rb +0 -0
  38. data/spec/dummy/config/environments/development.rb +0 -0
  39. data/spec/dummy/config/environments/production.rb +0 -0
  40. data/spec/dummy/config/environments/test.rb +0 -0
  41. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -0
  42. data/spec/dummy/config/initializers/inflections.rb +0 -0
  43. data/spec/dummy/config/initializers/mime_types.rb +1 -0
  44. data/spec/dummy/config/initializers/phrasing.rb +0 -0
  45. data/spec/dummy/config/initializers/secret_token.rb +0 -0
  46. data/spec/dummy/config/initializers/session_store.rb +0 -0
  47. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -0
  48. data/spec/dummy/config/locales/en.yml +0 -0
  49. data/spec/dummy/db/.gitkeep +0 -0
  50. data/spec/dummy/db/migrate/20131120000855_create_phrasing_phrases.phrasing_rails_engine.rb +0 -0
  51. data/spec/dummy/db/migrate/20131120000856_create_phrasing_phrase_versions.phrasing_rails_engine.rb +0 -0
  52. data/spec/dummy/public/404.html +0 -0
  53. data/spec/dummy/public/422.html +0 -0
  54. data/spec/dummy/public/500.html +0 -0
  55. data/spec/dummy/public/favicon.ico +0 -0
  56. data/spec/factories/phrasing_phrases.rb +0 -0
  57. data/spec/lib/phrasing_serializer_spec.rb +3 -3
  58. data/spec/models/phrasing_phrase_spec.rb +0 -0
  59. metadata +5 -6
  60. data/4.0.0_changes.md +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a638909e5f75504ad5a6775cf1af6fc6d0706dc
4
- data.tar.gz: 2c772e81d2089512e022b26ceea9f0199f7bd638
3
+ metadata.gz: ac71c985745a5d8d7ee591a4961f984c93c38e6e
4
+ data.tar.gz: c08b20fe85f8d0f79c065a686c4781ff4d18bfac
5
5
  SHA512:
6
- metadata.gz: 2daf9ac1fa5d83e5cbdce6b91989012ef6bd50ac2d3065a16bdfec3c7330817168032d4e8dfbaf9bad4f88dc2cb01ecfd54b85987fd0e134c7b4d0174f97e621
7
- data.tar.gz: 627ffd7cf5922061e5674f4072ac9296f9be293aa8c3ce24bfab1df022b831c8c0968180c4efdec652d716fb108156bf37cc272d24d8e564abeea39c38629bdd
6
+ metadata.gz: 814529d02b1759ae377698ec1377c53bc503933d6c43bb5bc664482eb0ec36ac9566f5642eba588e6ee233d93934895bfac35cfe6dd115838a04c6667a8925e4
7
+ data.tar.gz: 94f4bec1be3674a20c13960805845c7b4cdc9e9d1f6f4199f8afedbde1b0807bb23510fd25d33f1292d11d0b0e5e612c4cdcf91928ab8adf4a2b2ef343ba5f7a
@@ -8,8 +8,6 @@ script:
8
8
 
9
9
  matrix:
10
10
  include:
11
- - rvm: 2.0.0
12
- env: "RAILS_VERSION=4.0.0"
13
11
  - rvm: 2.1.2
14
12
  env: "RAILS_VERSION=4.1.0"
15
13
  - rvm: 2.2.0
@@ -1,5 +1,42 @@
1
1
  # Phrasing Change Log
2
2
 
3
+ ## 4.0.0 (February 27th, 2018)
4
+
5
+ ### Separation of I18n and Phrasing:
6
+
7
+ Phrasing no longer does monkeypatching over the I18n gem, so the I18n and Phrasings behaviors are completely separate.
8
+ When using the I18n.t() method, Phrasing will no longer copy the data from the translations file and continue to use translations from the database.
9
+
10
+ However, when using the phrase(key) method, if the key doesn't currently exist in the PhrasingPhrase table, it will do a lookup in the translations file and copy the data from there to the database.
11
+
12
+ ### Interpolation
13
+
14
+ The interpolation option has been kicked out.
15
+
16
+ The problem with the interpolation option is that most clients won't understand what's happening when they see something like "Hi, my name is %{name}" once they are editing data.
17
+
18
+ If they try to erase parts of it, the developer also might end up being confused and the UI might get broken or at least ugly for some time until the developer fixes the issue.
19
+
20
+ ### Loading asset dependencies
21
+
22
+ From phrasing v4.0.0rc3, add your jquery files manually:
23
+
24
+ ```javascript
25
+ //= require jquery
26
+ //= require jquery_ujs
27
+ //= require phrasing
28
+ ```
29
+
30
+ ### Switching rake tasks with Rails generators
31
+
32
+ Since Rails comes with outofbox generators that enable easy existing file detection and similar behaviors, Phrasing 4 will use Rails generators instead of the old rake tasks.
33
+
34
+ To run the initial setup generator, just do: `rails generate phrasing`
35
+
36
+ ## 3.2.10 (October 2nd, 2015)
37
+
38
+ Change order parameters in PhrasingPhrases#index to support SQLServer.
39
+
3
40
  ## 3.2.9 (January 7th, 2015)
4
41
 
5
42
  Require only haml, not haml-rails.
data/Gemfile CHANGED
@@ -9,6 +9,7 @@ gem 'rails', "~> #{rails_version}"
9
9
 
10
10
  gem 'capybara'
11
11
  gem 'factory_girl_rails'
12
+ gem 'jasmine-core', '~> 2.9.1'
12
13
  gem 'jasmine-rails'
13
14
  gem 'poltergeist'
14
15
  gem 'pry-rails'
File without changes
data/README.md CHANGED
@@ -2,12 +2,8 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/infinum/phrasing.png)](https://travis-ci.org/infinum/phrasing)
4
4
 
5
- ![Phrasing](http://www.miataturbo.net/attachments/miata-parts-sale-trade-5/74257-lots-leftovers-near-boston-archer-phrasing2-300x225-jpg?dateline=1366600534)
6
-
7
5
  Phrasing is a gem for live editing phrases (copy) on websites.
8
6
 
9
- **Notice:** If using Phrasing version 3, checkout the [old README](https://github.com/infinum/phrasing/blob/new-release-4/README-3.md).
10
-
11
7
  ## Installation
12
8
 
13
9
  Include the gem in your Gemfile
@@ -41,11 +37,9 @@ For example:
41
37
 
42
38
  ```ruby
43
39
  module PhrasingHelper
44
-
45
40
  def can_edit_phrases?
46
41
  current_user.is_admin?
47
42
  end
48
-
49
43
  end
50
44
  ```
51
45
  Include the phrasing **html** initializer at the top of your application layout file.
@@ -129,9 +123,9 @@ scope: 'homepage.footer' # add scopes just like you would w/ I18.n. If the first
129
123
  ## Credits
130
124
 
131
125
  Phrasing is maintained and sponsored by
132
- [Infinum] (http://www.infinum.co).
126
+ [Infinum](http://www.infinum.co).
133
127
 
134
- ![Infinum](https://www.infinum.co/assets/logo_pic-2e19713f50692ed9b0805b199676c19a.png)
128
+ <img src="https://infinum.co/infinum.png" width="264">
135
129
 
136
130
  Phrasing leverages parts of [Copycat](https://github.com/Zorros/copycat) and [ZenPen](https://github.com/tholman/zenpen/tree/master/).
137
131
 
data/Rakefile CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -16,7 +16,7 @@ class PhrasingPhrasesController < Phrasing.parent_controller.constantize
16
16
 
17
17
  def index
18
18
  params[:locale] ||= I18n.default_locale
19
- @phrasing_phrases = PhrasingPhrase.fuzzy_search(params[:search], params[:locale])
19
+ @phrasing_phrases = phrasing_phrases
20
20
  @locale_names = PhrasingPhrase.distinct.pluck(:locale)
21
21
  end
22
22
 
@@ -33,7 +33,7 @@ class PhrasingPhrasesController < Phrasing.parent_controller.constantize
33
33
  app_env = Rails.env
34
34
  time = Time.now.strftime('%Y_%m_%d_%H_%M_%S')
35
35
  filename = "phrasing_phrases_#{app_name}_#{app_env}_#{time}.yml"
36
- send_data Phrasing::Serializer.export_yaml, filename: filename
36
+ send_data Phrasing::Serializer.export_yaml(phrasing_phrases), filename: filename
37
37
  end
38
38
 
39
39
  def upload
@@ -84,4 +84,8 @@ class PhrasingPhrasesController < Phrasing.parent_controller.constantize
84
84
  redirect_to phrasing_phrases_path, notice: "#{phrase.key} updated!"
85
85
  end
86
86
 
87
+ def phrasing_phrases
88
+ PhrasingPhrase.fuzzy_search(params[:search], params[:locale])
89
+ end
90
+
87
91
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -4,6 +4,8 @@
4
4
  = select_tag 'locale', locale_options
5
5
  = text_field_tag :search, params[:search], placeholder: 'Search for keys or values', size: 40
6
6
  = submit_tag 'Search', class: "btn btn-success"
7
+ = link_to 'Download', download_phrasing_phrases_path(search: params[:search], locale: params[:locale]), class: 'btn btn-success'
8
+
7
9
  - if @phrasing_phrases.any?
8
10
  %table.all-phrases
9
11
  %thead
@@ -1,7 +1,7 @@
1
1
  module Phrasing
2
2
  module Serializer
3
3
  class << self
4
-
4
+
5
5
  def import_yaml(yaml)
6
6
  number_of_changes = 0
7
7
  hash = YAML.load(yaml)
@@ -16,7 +16,7 @@ module Phrasing
16
16
  end
17
17
  end
18
18
  end
19
-
19
+
20
20
  number_of_changes
21
21
  end
22
22
 
@@ -24,7 +24,7 @@ module Phrasing
24
24
  new_hash = {}
25
25
  hash.each do |key, value|
26
26
  if value.is_a? Hash
27
- flatten_the_hash(value).each do |k,v|
27
+ flatten_the_hash(value).each do |k,v|
28
28
  new_hash["#{key}.#{k}"] = v
29
29
  end
30
30
  else
@@ -34,9 +34,9 @@ module Phrasing
34
34
  new_hash
35
35
  end
36
36
 
37
- def export_yaml
37
+ def export_yaml(phrasing_phrases)
38
38
  hash = {}
39
- PhrasingPhrase.where("value is not null").each do |phrase|
39
+ phrasing_phrases.each do |phrase|
40
40
  hash[phrase.locale] ||= {}
41
41
  hash[phrase.locale][phrase.key] = phrase.value
42
42
  end
@@ -45,4 +45,4 @@ module Phrasing
45
45
 
46
46
  end
47
47
  end
48
- end
48
+ end
@@ -1,3 +1,3 @@
1
1
  module Phrasing
2
- VERSION = "4.0.0rc16"
2
+ VERSION = '4.0.0'.freeze
3
3
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -3,3 +3,4 @@
3
3
  # Add new mime types for use in respond_to blocks:
4
4
  # Mime::Type.register "text/richtext", :rtf
5
5
  # Mime::Type.register_alias "text/html", :iphone
6
+ Mime::Type.register "text/yaml", :yaml
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -118,7 +118,7 @@ describe Phrasing::Serializer do
118
118
  expect(english_phrases.where(key: "site.intro").first.value).to eq("Go Home")
119
119
  expect(english_phrases.where(key: "site.outro").first.value).to eq("Kthnx Bye")
120
120
 
121
- yaml = Phrasing::Serializer.export_yaml
121
+ yaml = Phrasing::Serializer.export_yaml(PhrasingPhrase.where("value is not null"))
122
122
 
123
123
  number_of_changes = Phrasing::Serializer.import_yaml(StringIO.new(yaml))
124
124
 
@@ -139,7 +139,7 @@ describe Phrasing::Serializer do
139
139
  expect(english_phrases.where(key: "site.intro").first.value).to eq("Go Home")
140
140
  expect(english_phrases.where(key: "site.outro").first.value).to eq("Kthnx Bye")
141
141
 
142
- yaml = Phrasing::Serializer.export_yaml
142
+ yaml = Phrasing::Serializer.export_yaml(PhrasingPhrase.where("value is not null"))
143
143
 
144
144
  expect(yaml).to match(/site.intro:\sGo Home/)
145
145
  expect(yaml).to match(/site.outro:\sKthnx Bye/)
@@ -152,7 +152,7 @@ describe Phrasing::Serializer do
152
152
  expect(english_phrases.where(key: "site.intro").first.value).to eq("Hello")
153
153
  expect(french_phrases.where(key: "site.intro").first.value).to eq("Bonjour")
154
154
 
155
- yaml = Phrasing::Serializer.export_yaml
155
+ yaml = Phrasing::Serializer.export_yaml(PhrasingPhrase.where("value is not null"))
156
156
 
157
157
  expect(yaml).to match(/en:\s*\n\s*site.intro:\sHello/)
158
158
  expect(yaml).to match(/fr:\s*\n\s*site.intro:\sBonjour/)
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phrasing
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0rc16
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomislav Car
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-09-08 00:00:00.000000000 Z
12
+ date: 2018-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -89,7 +89,6 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
91
  - ".travis.yml"
92
- - 4.0.0_changes.md
93
92
  - CHANGELOG.md
94
93
  - Gemfile
95
94
  - MIT-LICENSE
@@ -196,12 +195,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
196
195
  version: '0'
197
196
  required_rubygems_version: !ruby/object:Gem::Requirement
198
197
  requirements:
199
- - - ">"
198
+ - - ">="
200
199
  - !ruby/object:Gem::Version
201
- version: 1.3.1
200
+ version: '0'
202
201
  requirements: []
203
202
  rubyforge_project:
204
- rubygems_version: 2.6.11
203
+ rubygems_version: 2.4.5
205
204
  signing_key:
206
205
  specification_version: 4
207
206
  summary: Edit phrases inline for Rails applications!
@@ -1 +0,0 @@
1
- # Changes