phrasing 4.0.0rc4 → 4.0.0rc5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ec5cf82a1f8789b4f8c7f25f1fd93ec9c370ded
4
- data.tar.gz: 9d92db89baa70f2adf1fd122ced6cb949ee4e44e
3
+ metadata.gz: 7b0757a83e101496cafb49039b3ab1efe078014d
4
+ data.tar.gz: 66fa7004242054c8bf4525a869aaa26b09cf6140
5
5
  SHA512:
6
- metadata.gz: 1ab0220b8ad7cf33ec522ba8155d2aeb65ffed693bb2c4eed8a8ce736efc0ae8b96d859618829092b6c3a6984dd4a13affe8cc9935fafc199f08ea3f9afd717b
7
- data.tar.gz: 61f3907edde2443d5b50f050f01edfec95f258614601aebc3d77e02db8795868a6067b4e17e7ab6318cf7ce9436dd666271e80edcf7812b9bf470261d40b9197
6
+ metadata.gz: eacb10e6cb2bc6267a399429b112e67eacfcd55f7a194a50c6e334831950595ea66c90a9d108c4b5e65f5451112cc89baab9316b23506316abb6e8cf187fc184
7
+ data.tar.gz: 8eb444d1fe8d14a634aaf0b1b3b0519f9c3a669b959aa1885573bd0da787c8d199f1738c7a58ad574f039468e9d134f88dcc31341d18a16f917d2ef9b2fc8ddb
@@ -36,7 +36,7 @@ var editor = (function() {
36
36
  checkTextHighlighting( event );
37
37
  }, 1);
38
38
  };
39
-
39
+
40
40
  // Window bindings
41
41
  window.addEventListener( 'resize', function( event ) {
42
42
  updateBubblePosition();
@@ -47,15 +47,15 @@ var editor = (function() {
47
47
  // http://ejohn.org/blog/learning-from-twitter
48
48
  var scrollEnabled = true;
49
49
  document.body.addEventListener( 'scroll', function() {
50
-
50
+
51
51
  if ( !scrollEnabled ) {
52
52
  return;
53
53
  }
54
-
54
+
55
55
  scrollEnabled = true;
56
-
56
+
57
57
  updateBubblePosition();
58
-
58
+
59
59
  return setTimeout((function() {
60
60
  scrollEnabled = true;
61
61
  }), 250);
@@ -100,7 +100,7 @@ var editor = (function() {
100
100
  if (event.target.parentNode.classList.contains("ui-inputs")){
101
101
  currentNodeList = findNodes( selection.focusNode );
102
102
  updateBubbleStates();
103
- return;
103
+ return;
104
104
  }
105
105
  }
106
106
 
@@ -125,12 +125,12 @@ var editor = (function() {
125
125
 
126
126
  lastType = selection.isCollapsed;
127
127
  }
128
-
128
+
129
129
  function updateBubblePosition() {
130
130
  var selection = window.getSelection();
131
131
  var range = selection.getRangeAt(0);
132
132
  var boundary = range.getBoundingClientRect();
133
-
133
+
134
134
  textOptions.style.top = boundary.top - 5 + window.pageYOffset + "px";
135
135
  textOptions.style.left = (boundary.left + boundary.right)/2 + "px";
136
136
  }
@@ -201,7 +201,7 @@ var editor = (function() {
201
201
  //if any of its parents has the class of 'phrasable' go hooray
202
202
  while ( element.parentNode ) {
203
203
  if (element.className !== undefined){
204
- if (element.className.indexOf("phrasable_on")>=0){
204
+ if (element.className.indexOf("phrasable-on")>=0){
205
205
  return true;
206
206
  }
207
207
  }
@@ -307,4 +307,4 @@ var editor = (function() {
307
307
  init: init
308
308
  }
309
309
 
310
- })();
310
+ })();
@@ -5,6 +5,10 @@ var Phrasing = {
5
5
  EDIT_MODE_KEY : 'editing-mode'
6
6
  };
7
7
 
8
+ Phrasing.isEditModeEnabled = function(){
9
+ return localStorage.getItem(this.EDIT_MODE_KEY) === "true";
10
+ };
11
+
8
12
  function StatusBubbleWidget(options){
9
13
  this.$statusText = options.$statusText;
10
14
  this.$statusIndicator = options.$statusIndicator;
@@ -20,12 +20,12 @@ module InlineHelper
20
20
  return uneditable_phrase(record, attribute) unless can_edit_phrases?
21
21
 
22
22
  klass = 'phrasable'
23
- klass += ' inverse' if options[:inverse]
24
- klass += options[:class] if options[:class]
23
+ klass += ' inverse' if options[:inverse]
24
+ klass += ' ' + options[:class] if options[:class]
25
25
 
26
26
  url = phrasing_polymorphic_url(record, attribute)
27
27
 
28
- content_tag(:span, class: klass, contenteditable: true, spellcheck: false, 'data-url' => url) do
28
+ content_tag(:span, class: klass, spellcheck: false, 'data-url' => url) do
29
29
  (record.send(attribute) || record.try(:key)).to_s.html_safe
30
30
  end
31
31
  end
@@ -1,3 +1,3 @@
1
1
  module Phrasing
2
- VERSION = "4.0.0rc4"
2
+ VERSION = "4.0.0rc5"
3
3
  end
@@ -14,10 +14,10 @@ feature 'edit mode bubble' do
14
14
  expect(edit_mode_checkbox).not_to be_checked
15
15
  end
16
16
 
17
- it "phrases should have class 'phrasable_on' and contenteditable=true" do
17
+ it "phrases initially shouldn't have class 'phrasable-on' and contenteditable=true" do
18
18
  expect(page.find('.header').first('.phrasable').text).to eq 'The Header'
19
- expect(page.find('.header').first('.phrasable')['class']).to eq 'phrasable phrasable_on'
20
- expect(page.find('.header').first('.phrasable')['contenteditable']).to eq 'true'
19
+ expect(page.find('.header').first('.phrasable')['class']).to eq 'phrasable'
20
+ expect(page.find('.header').first('.phrasable')['contenteditable']).to be_nil
21
21
  end
22
22
 
23
23
  it 'should be able to visit phrasing index via edit_all icon' do
@@ -406,4 +406,4 @@ feature "locales" do
406
406
  expect(yaml).to match(/es:\s*hello: mundo/)
407
407
  end
408
408
 
409
- end
409
+ end
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.0rc4
4
+ version: 4.0.0rc5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomislav Car