cortex-plugins-core 0.8.0 → 0.9.0

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: 5489b6865671e3bc3cf9b5773f555dbcb9ab04cc
4
- data.tar.gz: e2143aab01765d095069e833fc61a1fead48af87
3
+ metadata.gz: 82c5f29246b247faa0240f0f158bf58324f8fe7c
4
+ data.tar.gz: 4303743945edb31897ded379045e318dcaac7b37
5
5
  SHA512:
6
- metadata.gz: '02842cea4d6d268772aa7132d3d89993a6a5ad60de36a7e24f1d55da0387688cb604ee434dd7f6c4d3d9eb8f4c8406ee06d404d8bca0e8c791933cf61717dee6'
7
- data.tar.gz: e09f70106d28fac356f083515e148328506bfa5c5d4dd9628dc34310ffa235476423adaa4c0359fb261fb951266c7dbab16a5bde4cdf185372a61a01ee5258c5
6
+ metadata.gz: e20309de17fd952e47c8950b61e734214346ef6e67531d5ca2b285f22d7d158562c5742048625b68f2f660da412d30fa53d95d842936d1ca93867a88cbbbf4df
7
+ data.tar.gz: 99910694787efc918ad733df65c2a2db217ca4db02bccdbe6439e108e4ebe954fc2cc138c17bfb9ab4ee7d74f6499eaa871b2a17c1dc96fe0d6979939a8ffa63
@@ -5,20 +5,45 @@
5
5
  requires: 'widget',
6
6
  init: function (editor) {
7
7
  editor.widgets.add('media', {
8
- template: '<media><img></media>',
8
+ template: '<media></media>',
9
9
  data: function () {
10
10
  if (this.data.id) {
11
- var image_element = this.element.getFirst(),
12
- alt_text = this.data.alt || this.data.title;
11
+ var child_element,
12
+ alt_text = this.data.alt || this.data.title,
13
+ width = this.data.width || this.element.getAttribute('width'),
14
+ height = this.data.height || this.element.getAttribute('height'),
15
+ style = this.data.style || this.element.getAttribute('style'),
16
+ className = this.data.class || this.element.getAttribute('class');
13
17
 
14
- this.element.setAttribute('id', this.data.id);
15
- image_element.setAttribute('src', this.data.image_source);
16
- image_element.setAttribute('alt', alt_text);
18
+ if (this.data.asset_type === 'image') {
19
+ child_element = new CKEDITOR.dom.element('img');
20
+
21
+ if (this.data.id) {
22
+ this.element.setAttribute('id', this.data.id);
23
+ child_element.setAttribute('src', this.data.url);
24
+ child_element.setAttribute('alt', alt_text);
25
+ }
26
+
27
+ if (width) child_element.setAttribute('width', width);
28
+ if (height) child_element.setAttribute('height', height);
29
+ if (style) child_element.setAttribute('style', style);
30
+ if (className) child_element.setAttribute('class', className);
31
+ } else {
32
+ child_element = new CKEDITOR.dom.element('a');
33
+
34
+ if (this.data.id) {
35
+ this.element.setAttribute('id', this.data.id);
36
+ child_element.setAttribute('href', this.data.url);
37
+ child_element.setText(alt_text)
38
+ }
39
+ }
40
+
41
+ this.element.append(child_element);
17
42
  }
18
43
  },
19
- requiredContent: 'media; img',
44
+ requiredContent: 'media',
20
45
  upcast: function (element) {
21
- return element.name == 'media';
46
+ return element.name === 'media';
22
47
  }
23
48
  });
24
49
 
@@ -37,8 +62,9 @@
37
62
  startupData: {
38
63
  id: media.id,
39
64
  title: media.title,
40
- image_source: media.src,
41
- alt: media.alt
65
+ url: media.url,
66
+ alt: media.alt,
67
+ asset_type: media.asset_type
42
68
  }
43
69
  });
44
70
  });
@@ -16,7 +16,7 @@ module Plugins
16
16
  end
17
17
 
18
18
  def user_data_for_select
19
- @options[:user_data].map{ |user| [user.fullname, user.id] }
19
+ @options[:user_data].map{ |user| ["#{user.fullname} (#{user.email})", user.id] }
20
20
  end
21
21
  end
22
22
  end
@@ -1,7 +1,7 @@
1
1
  module Cortex
2
2
  module Plugins
3
3
  module Core
4
- VERSION = '0.8.0'
4
+ VERSION = '0.9.0'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cortex-plugins-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CareerBuilder Employer Site & Content Products
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-05 00:00:00.000000000 Z
11
+ date: 2017-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails