phrasing 4.0.0rc15 → 4.0.0rc16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.travis.yml +5 -0
- data/4.0.0_changes.md +0 -0
- data/CHANGELOG.md +0 -0
- data/Gemfile +9 -8
- data/MIT-LICENSE +0 -0
- data/README-3.md +0 -0
- data/Rakefile +0 -0
- data/app/assets/fonts/icomoon.dev.svg +0 -0
- data/app/assets/fonts/icomoon.eot +0 -0
- data/app/assets/fonts/icomoon.svg +0 -0
- data/app/assets/fonts/icomoon.ttf +0 -0
- data/app/assets/fonts/icomoon.woff +0 -0
- data/app/assets/images/phrasing_icon_edit_all.png +0 -0
- data/app/assets/javascripts/editor.js +1 -0
- data/app/assets/javascripts/phrasing.js +13 -0
- data/app/assets/javascripts/phrasing_engine.js +0 -0
- data/app/assets/stylesheets/phrasing.scss +0 -0
- data/app/assets/stylesheets/phrasing_edit_mode_bubble.scss +0 -0
- data/app/assets/stylesheets/phrasing_engine.css +0 -0
- data/app/assets/stylesheets/phrasing_fonts.scss +0 -0
- data/app/controllers/phrasing_phrase_versions_controller.rb +0 -0
- data/app/helpers/inline_helper.rb +0 -0
- data/app/models/phrasing_phrase.rb +0 -0
- data/app/models/phrasing_phrase_version.rb +0 -0
- data/app/views/layouts/phrasing.html.haml +0 -0
- data/app/views/phrasing/_initializer.html.haml +0 -0
- data/app/views/phrasing/_menu.html.haml +0 -0
- data/app/views/phrasing/_messages.html.haml +0 -0
- data/app/views/phrasing/_production_warning.html.haml +0 -0
- data/app/views/phrasing_phrases/edit.html.haml +0 -0
- data/app/views/phrasing_phrases/help.html.haml +0 -0
- data/app/views/phrasing_phrases/import_export.html.haml +0 -0
- data/app/views/phrasing_phrases/index.html.haml +0 -0
- data/config/routes.rb +0 -0
- data/lib/generators/phrasing/phrasing_generator.rb +0 -0
- data/lib/generators/phrasing/templates/app/helpers/phrasing_helper.rb +0 -0
- data/lib/generators/phrasing/templates/config/initializers/phrasing.rb +0 -0
- data/lib/generators/phrasing/templates/db/migrate/create_phrasing_phrase_versions.rb +0 -0
- data/lib/generators/phrasing/templates/db/migrate/create_phrasing_phrases.rb +0 -0
- data/lib/phrasing/rails/engine.rb +0 -0
- data/lib/phrasing/serializer.rb +0 -0
- data/lib/phrasing/version.rb +1 -1
- data/spec/controllers/phrasing_phrases_controller.rb +0 -0
- data/spec/dummy/Rakefile +0 -0
- data/spec/dummy/app/assets/stylesheets/application.scss +0 -0
- data/spec/dummy/app/controllers/application_controller.rb +0 -0
- data/spec/dummy/app/controllers/site_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +0 -0
- data/spec/dummy/app/helpers/phrasing_helper.rb +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +0 -0
- data/spec/dummy/app/views/site/example.html.erb +1 -0
- data/spec/dummy/app/views/site/index.html.erb +4 -0
- data/spec/dummy/config.ru +0 -0
- data/spec/dummy/config/application.rb +0 -0
- data/spec/dummy/config/boot.rb +0 -0
- data/spec/dummy/config/database.yml +0 -0
- data/spec/dummy/config/environment.rb +0 -0
- data/spec/dummy/config/environments/development.rb +0 -0
- data/spec/dummy/config/environments/production.rb +0 -0
- data/spec/dummy/config/environments/test.rb +0 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/dummy/config/initializers/inflections.rb +0 -0
- data/spec/dummy/config/initializers/mime_types.rb +0 -0
- data/spec/dummy/config/initializers/phrasing.rb +0 -0
- data/spec/dummy/config/initializers/secret_token.rb +0 -0
- data/spec/dummy/config/initializers/session_store.rb +0 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/spec/dummy/config/locales/en.yml +0 -0
- data/spec/dummy/config/routes.rb +1 -0
- data/spec/dummy/db/.gitkeep +0 -0
- data/spec/dummy/db/migrate/20131120000855_create_phrasing_phrases.phrasing_rails_engine.rb +0 -0
- data/spec/dummy/db/migrate/20131120000856_create_phrasing_phrase_versions.phrasing_rails_engine.rb +0 -0
- data/spec/dummy/db/schema.rb +3 -4
- data/spec/dummy/public/404.html +0 -0
- data/spec/dummy/public/422.html +0 -0
- data/spec/dummy/public/500.html +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/phrasing_phrases.rb +0 -0
- data/spec/features/dummy_spec.rb +44 -3
- data/spec/features/phrasing_spec.rb +2 -4
- data/spec/lib/phrasing_serializer_spec.rb +3 -0
- data/spec/lib/phrasing_spec.rb +0 -0
- data/spec/models/phrasing_phrase_spec.rb +0 -0
- data/spec/spec_helper.rb +3 -0
- metadata +4 -4
- data/spec/dummy/db/test.sqlite3 +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a638909e5f75504ad5a6775cf1af6fc6d0706dc
|
4
|
+
data.tar.gz: 2c772e81d2089512e022b26ceea9f0199f7bd638
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2daf9ac1fa5d83e5cbdce6b91989012ef6bd50ac2d3065a16bdfec3c7330817168032d4e8dfbaf9bad4f88dc2cb01ecfd54b85987fd0e134c7b4d0174f97e621
|
7
|
+
data.tar.gz: 627ffd7cf5922061e5674f4072ac9296f9be293aa8c3ce24bfab1df022b831c8c0968180c4efdec652d716fb108156bf37cc272d24d8e564abeea39c38629bdd
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/4.0.0_changes.md
CHANGED
File without changes
|
data/CHANGELOG.md
CHANGED
File without changes
|
data/Gemfile
CHANGED
@@ -1,16 +1,17 @@
|
|
1
|
-
|
2
|
-
source "https://rubygems.org"
|
1
|
+
source 'https://rubygems.org'
|
3
2
|
|
4
3
|
gemspec
|
5
4
|
|
6
|
-
rails_version = ENV[
|
5
|
+
rails_version = ENV['RAILS_VERSION'] || '5.0.0'
|
7
6
|
|
8
|
-
gem
|
7
|
+
gem 'nokogiri', '~> 1.6.8'
|
8
|
+
gem 'rails', "~> #{rails_version}"
|
9
9
|
|
10
|
+
gem 'capybara'
|
10
11
|
gem 'factory_girl_rails'
|
11
|
-
gem 'sqlite3'
|
12
|
-
gem 'rspec-rails'
|
13
|
-
gem 'capybara', '~> 2.7.0'
|
14
12
|
gem 'jasmine-rails'
|
13
|
+
gem 'poltergeist'
|
15
14
|
gem 'pry-rails'
|
16
|
-
gem '
|
15
|
+
gem 'rspec-rails'
|
16
|
+
gem 'sass'
|
17
|
+
gem 'sqlite3'
|
data/MIT-LICENSE
CHANGED
File without changes
|
data/README-3.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -55,11 +55,13 @@ var phrasing_setup = function(){
|
|
55
55
|
Phrasing.Bus.on('phrasing:edit-mode:on', function(){
|
56
56
|
$('.phrasable').addClass("phrasable-on").attr("contenteditable", 'true');
|
57
57
|
localStorage.setItem(Phrasing.EDIT_MODE_KEY, 'true');
|
58
|
+
disable_links();
|
58
59
|
});
|
59
60
|
|
60
61
|
Phrasing.Bus.on('phrasing:edit-mode:off', function(){
|
61
62
|
$('.phrasable').removeClass("phrasable-on").attr("contenteditable", "false");
|
62
63
|
localStorage.setItem(Phrasing.EDIT_MODE_KEY, "false");
|
64
|
+
enable_links();
|
63
65
|
});
|
64
66
|
|
65
67
|
// Initialize the editing bubble
|
@@ -148,6 +150,17 @@ var phrasing_setup = function(){
|
|
148
150
|
$('#edit-mode-onoffswitch').prop('checked', false).change();
|
149
151
|
}
|
150
152
|
|
153
|
+
function disable_links() {
|
154
|
+
$('a').on("click.phrasing", function(e){
|
155
|
+
if($(this).find('span').hasClass('phrasable')) {
|
156
|
+
e.preventDefault();
|
157
|
+
}
|
158
|
+
});
|
159
|
+
}
|
160
|
+
|
161
|
+
function enable_links() {
|
162
|
+
$('a').off('click.phrasing')
|
163
|
+
}
|
151
164
|
};
|
152
165
|
|
153
166
|
$(document).ready(phrasing_setup);
|
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
|
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
|
data/config/routes.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/phrasing/serializer.rb
CHANGED
File without changes
|
data/lib/phrasing/version.rb
CHANGED
File without changes
|
data/spec/dummy/Rakefile
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
Example page for phrasing
|
data/spec/dummy/config.ru
CHANGED
File without changes
|
File without changes
|
data/spec/dummy/config/boot.rb
CHANGED
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/dummy/config/routes.rb
CHANGED
data/spec/dummy/db/.gitkeep
CHANGED
File without changes
|
File without changes
|
data/spec/dummy/db/migrate/20131120000856_create_phrasing_phrase_versions.phrasing_rails_engine.rb
CHANGED
File without changes
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
# This file is auto-generated from the current state of the database. Instead
|
3
2
|
# of editing this file, please use the migrations feature of Active Record to
|
4
3
|
# incrementally modify your database, and then regenerate this schema definition.
|
@@ -13,14 +12,14 @@
|
|
13
12
|
|
14
13
|
ActiveRecord::Schema.define(version: 20131120000856) do
|
15
14
|
|
16
|
-
create_table "phrasing_phrase_versions", force:
|
17
|
-
t.
|
15
|
+
create_table "phrasing_phrase_versions", force: :cascade do |t|
|
16
|
+
t.integer "phrasing_phrase_id"
|
18
17
|
t.text "value"
|
19
18
|
t.datetime "created_at"
|
20
19
|
t.datetime "updated_at"
|
21
20
|
end
|
22
21
|
|
23
|
-
create_table "phrasing_phrases", force:
|
22
|
+
create_table "phrasing_phrases", force: :cascade do |t|
|
24
23
|
t.string "locale"
|
25
24
|
t.string "key"
|
26
25
|
t.text "value"
|
data/spec/dummy/public/404.html
CHANGED
File without changes
|
data/spec/dummy/public/422.html
CHANGED
File without changes
|
data/spec/dummy/public/500.html
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/spec/features/dummy_spec.rb
CHANGED
@@ -2,31 +2,34 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
feature "use #phrase" do
|
5
|
-
|
6
5
|
it "should see the header phrase" do
|
7
6
|
visit root_path
|
8
7
|
expect(page).to have_content('The Header')
|
9
8
|
end
|
10
9
|
|
11
10
|
it "should see the header phrase modified if created before visiting" do
|
11
|
+
PhrasingPhrase.where(key: 'site.index.header').destroy_all
|
12
12
|
FactoryGirl.create(:phrasing_phrase, key: 'site.index.header', value: 'The Header1')
|
13
13
|
visit root_path
|
14
14
|
expect(page).to have_content 'The Header1'
|
15
15
|
end
|
16
16
|
|
17
17
|
it "creates a phrasing_phrase if the yaml has an entry" do
|
18
|
+
PhrasingPhrase.where(key: 'site.index.header').destroy_all
|
18
19
|
expect(PhrasingPhrase.find_by_key('site.index.header')).to be_nil
|
19
20
|
visit root_path
|
20
21
|
expect(PhrasingPhrase.find_by_key('site.index.header')).not_to be_nil
|
21
22
|
end
|
22
23
|
|
23
24
|
it "creates a phrasing_phrase if the yaml does not have an entry" do
|
25
|
+
PhrasingPhrase.where(key: 'site.index.intro').destroy_all
|
24
26
|
expect(PhrasingPhrase.find_by_key('site.index.intro')).to be_nil
|
25
27
|
visit root_path
|
26
28
|
expect(PhrasingPhrase.find_by_key('site.index.intro')).not_to be_nil
|
27
29
|
end
|
28
30
|
|
29
31
|
it "shows the phrasing_phrase instead of the yaml" do
|
32
|
+
PhrasingPhrase.where(key: 'site.index.header').destroy_all
|
30
33
|
FactoryGirl.create(:phrasing_phrase, key: 'site.index.header', value: 'A different header')
|
31
34
|
visit root_path
|
32
35
|
expect(page).not_to have_content 'The Header'
|
@@ -34,6 +37,7 @@ feature "use #phrase" do
|
|
34
37
|
end
|
35
38
|
|
36
39
|
it "allows to treat every translation as html safe" do
|
40
|
+
PhrasingPhrase.where(key: 'site.index.header').destroy_all
|
37
41
|
FactoryGirl.create(:phrasing_phrase, key: 'site.index.header', value: '<strong>Strong header</strong>')
|
38
42
|
visit root_path
|
39
43
|
expect(page).to have_content 'Strong header'
|
@@ -47,9 +51,46 @@ feature "use #phrase" do
|
|
47
51
|
expect(page).to have_content 'models.errors.test'
|
48
52
|
expect(page).to have_content 'site.test'
|
49
53
|
end
|
54
|
+
|
55
|
+
context 'preventing link redirects', js: true do
|
56
|
+
context 'edit mode is enabled' do
|
57
|
+
it 'should prevent phrasing link redirects' do
|
58
|
+
visit root_path
|
59
|
+
find('#phrasing-onoffswitch').click
|
60
|
+
click_link 'Editable link'
|
61
|
+
expect(page).not_to have_content 'Example page for phrasing'
|
62
|
+
expect(page).to have_content 'Editable link'
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should not prevent other link redirects' do
|
66
|
+
visit root_path
|
67
|
+
click_link 'Uneditable link'
|
68
|
+
expect(page).to have_content 'Example page for phrasing'
|
69
|
+
expect(page).not_to have_content 'Editable link'
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'should not prevent the phrasing edit all phrases link' do
|
73
|
+
visit root_path
|
74
|
+
find('#phrasing-edit-all-phrases-icon-container').click
|
75
|
+
expect(page).to have_content 'Phrasing'
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context 'edit mode is disabled' do
|
80
|
+
it 'should not prevent link redirects' do
|
81
|
+
visit root_path
|
82
|
+
click_link 'Editable link'
|
83
|
+
expect(page).to have_content 'Example page for phrasing'
|
84
|
+
expect(page).not_to have_content 'Editable link'
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
50
88
|
end
|
51
89
|
|
52
90
|
feature "locales" do
|
91
|
+
before do
|
92
|
+
PhrasingPhrase.destroy_all
|
93
|
+
end
|
53
94
|
|
54
95
|
it "displays different text based on users' locale" do
|
55
96
|
FactoryGirl.create(:phrasing_phrase, locale: 'en', key: 'site.index.intro', value: 'world')
|
@@ -70,7 +111,7 @@ feature "locales" do
|
|
70
111
|
expect(page).not_to have_content 'world'
|
71
112
|
expect(page).not_to have_content 'mundo'
|
72
113
|
|
73
|
-
I18n.locale = :en
|
114
|
+
I18n.locale = :en # reset
|
74
115
|
end
|
75
116
|
|
76
117
|
end
|
@@ -94,4 +135,4 @@ feature "yaml" do
|
|
94
135
|
expect(PhrasingPhrase.find_by_key('site.index.footer')).to be_nil
|
95
136
|
end
|
96
137
|
end
|
97
|
-
end
|
138
|
+
end
|
@@ -294,7 +294,7 @@ feature 'phrase versions' do
|
|
294
294
|
end
|
295
295
|
|
296
296
|
feature "downloading and uploading yaml files" do
|
297
|
-
|
297
|
+
before do
|
298
298
|
PhrasingPhrase.destroy_all
|
299
299
|
end
|
300
300
|
|
@@ -368,10 +368,9 @@ end
|
|
368
368
|
|
369
369
|
feature "locales" do
|
370
370
|
before do
|
371
|
-
end
|
372
|
-
after do
|
373
371
|
PhrasingPhrase.destroy_all
|
374
372
|
end
|
373
|
+
|
375
374
|
it "imports yaml containing multiple locales" do
|
376
375
|
file = Tempfile.new 'phrasing'
|
377
376
|
file.write <<-YAML
|
@@ -405,5 +404,4 @@ feature "locales" do
|
|
405
404
|
expect(yaml).to match(/en:\s*hello: world/)
|
406
405
|
expect(yaml).to match(/es:\s*hello: mundo/)
|
407
406
|
end
|
408
|
-
|
409
407
|
end
|
@@ -129,6 +129,9 @@ describe Phrasing::Serializer do
|
|
129
129
|
end
|
130
130
|
|
131
131
|
context 'export_yaml' do
|
132
|
+
before do
|
133
|
+
PhrasingPhrase.destroy_all
|
134
|
+
end
|
132
135
|
it 'flattened phrases' do
|
133
136
|
FactoryGirl.create(:phrasing_phrase, key: "site.intro", value: "Go Home")
|
134
137
|
FactoryGirl.create(:phrasing_phrase, key: "site.outro", value: "Kthnx Bye")
|
data/spec/lib/phrasing_spec.rb
CHANGED
File without changes
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
@@ -2,9 +2,12 @@ ENV["RAILS_ENV"] = 'test'
|
|
2
2
|
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
3
3
|
require 'rspec/rails'
|
4
4
|
require 'capybara/rspec'
|
5
|
+
require 'capybara/poltergeist'
|
5
6
|
require 'tempfile'
|
6
7
|
require 'pry'
|
7
8
|
|
9
|
+
Capybara.javascript_driver = :poltergeist
|
10
|
+
|
8
11
|
Dir["#{File.dirname(__FILE__)}/factories/**/*.rb"].each { |f| require f }
|
9
12
|
|
10
13
|
RSpec.configure do |config|
|
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.
|
4
|
+
version: 4.0.0rc16
|
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:
|
12
|
+
date: 2017-09-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -145,6 +145,7 @@ files:
|
|
145
145
|
- spec/dummy/app/helpers/phrasing_helper.rb
|
146
146
|
- spec/dummy/app/models/.gitkeep
|
147
147
|
- spec/dummy/app/views/layouts/application.html.erb
|
148
|
+
- spec/dummy/app/views/site/example.html.erb
|
148
149
|
- spec/dummy/app/views/site/index.html.erb
|
149
150
|
- spec/dummy/config.ru
|
150
151
|
- spec/dummy/config/application.rb
|
@@ -167,7 +168,6 @@ files:
|
|
167
168
|
- spec/dummy/db/migrate/20131120000855_create_phrasing_phrases.phrasing_rails_engine.rb
|
168
169
|
- spec/dummy/db/migrate/20131120000856_create_phrasing_phrase_versions.phrasing_rails_engine.rb
|
169
170
|
- spec/dummy/db/schema.rb
|
170
|
-
- spec/dummy/db/test.sqlite3
|
171
171
|
- spec/dummy/public/404.html
|
172
172
|
- spec/dummy/public/422.html
|
173
173
|
- spec/dummy/public/500.html
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
version: 1.3.1
|
202
202
|
requirements: []
|
203
203
|
rubyforge_project:
|
204
|
-
rubygems_version: 2.
|
204
|
+
rubygems_version: 2.6.11
|
205
205
|
signing_key:
|
206
206
|
specification_version: 4
|
207
207
|
summary: Edit phrases inline for Rails applications!
|
data/spec/dummy/db/test.sqlite3
DELETED
Binary file
|