biola_wcms_components 0.2.1 → 0.3.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: ad43cf94ae5f7f3c298b9863ec8acae5fa28e5d2
4
- data.tar.gz: d653206bde30cee1b55c8068b1497c23a0b70874
3
+ metadata.gz: e8923842f9aa5259010d882588b06970b3bfd005
4
+ data.tar.gz: af976f1cb38616b4424f28583c1f73af615c3e58
5
5
  SHA512:
6
- metadata.gz: 1f68c613bfe2f706da1ab5718266a066ba60ef2c68d857ef212f879a73f904da3c2b1edccc17a617b1eb4d0cc78df6b537569e045bc36e1e2deb0f2a0f58247b
7
- data.tar.gz: 586484d9d7e6385b37503c9b6cbf193cbe4cbd656f6e5796c323fdb7fdc4febddc06fd71a78fa60972f07dc0054a5a8c78dfe0ffb78346bbaa8b2085bf6b9f48
6
+ metadata.gz: b128af6f966ae9eaacb5073a0313a2d6a8dddc6615a21d59884d33f0d7e691d5f44ebddada43c1c2090099907616cf608140d490b186ca52d34b1ae9efbb4260
7
+ data.tar.gz: ea35749a0432ddee47197d3acdc3ddf79edaa0049c169bf16f8b715805347e84cdd8ef441970416a8605f17563410729adcecd1723f83bda7b3b8f59411713e7
@@ -49,6 +49,7 @@ $(document).ready ->
49
49
  uploadImage = (file, input) ->
50
50
  fileUploader.sendFileToServer file, 'embedded_image', ((url) ->
51
51
  input.value = url
52
+ $(input).trigger('change')
52
53
  ), ->
53
54
  alert('There was a problem uploading the image')
54
55
 
@@ -67,3 +68,7 @@ $(document).ready ->
67
68
  event.stopPropagation()
68
69
  uploadImage(e.originalEvent.dataTransfer.files[0], this)
69
70
  $(this).removeClass('dragging')
71
+
72
+ # Update preview image whenever value changes
73
+ $('#presentation_data_editor').on 'change', 'input.drop-image-uploader', (e) ->
74
+ $(this).siblings('.image_preview').find('img').attr('src', this.value)
@@ -4,10 +4,15 @@ setupRedactor = (obj) ->
4
4
  minHeight: 200
5
5
  allowedTags: ['p', 'br']
6
6
  buttons: []
7
+ toolbarFixed: false
8
+
9
+ if fileUploader.uploaders && fileUploader.uploaders.embedded_image
10
+ options.imageUpload = fileUploader.uploaders.embedded_image
11
+ options.allowedTags = $.merge(options.allowedTags, ['img'])
7
12
 
8
13
  # Add any custom data attributes to the default options
9
14
  if obj.data('linkable') # in case you want to support links without explicitly giving a link button.
10
- options.allowedTags = $.merge(options.allowedTags, 'a')
15
+ options.allowedTags = $.merge(options.allowedTags, ['a'])
11
16
  if data = obj.data('buttons')
12
17
  buttons = data.split(' ')
13
18
  options.buttons = $.merge(options.buttons, buttons)
@@ -32,6 +32,9 @@
32
32
  }
33
33
  }
34
34
 
35
+ .type-image-uploader {
36
+ .image_preview img { margin-top: 5px; max-height: 300px; max-width: 100%; }
37
+ }
35
38
  .drop-image-uploader {
36
39
  &.dragging { background-color: #deedff; }
37
40
  }
@@ -13,7 +13,7 @@ class WcmsComponents::EmbeddedImagesController < ApplicationController
13
13
  if @embedded_image.save
14
14
  render json: { filelink: @embedded_image.upload.url }
15
15
  else
16
- render json: { error: true, messages: @embedded_image.errors.full_messages}
16
+ render json: { error: true, messages: @embedded_image.errors.full_messages }
17
17
  end
18
18
  end
19
19
 
@@ -4,16 +4,28 @@ ruby:
4
4
  lookup_url ||= wcms_components_people_url
5
5
  placeholder ||= 'First or last name'
6
6
  required ||= false
7
+ person ||= nil
8
+ value ||= nil # just an alias for person
9
+
10
+ html_options = { placeholder: placeholder, required: required, class: 'form-control typeahead' }
11
+
12
+ # Find person object
13
+ if person
14
+ # don't override person if it is already set.
15
+ elsif value
16
+ person = value if value.is_a?(Person)
17
+ elsif form
18
+ person = Person.where(id: form.object[person_id_key]).first if form.object.respond_to?(person_id_key)
19
+ end
7
20
 
8
- html_options = {placeholder: placeholder, required: required, class: 'form-control typeahead'}
9
21
 
10
22
  - if lookup_url
11
23
  .person-lookup data-lookup-url=lookup_url
12
24
  - if form
13
25
  = form.hidden_field person_id_key, class: 'hidden-person-id'
14
26
  - else
15
- = hidden_field_tag person_id_key, '', class: 'hidden-person-id'
16
- = text_field_tag :person_name, '', html_options
27
+ = hidden_field_tag person_id_key, person.try(:id), class: 'hidden-person-id'
28
+ = text_field_tag :person_name, person.try(:name), html_options
17
29
 
18
30
  - else
19
31
  p
@@ -30,6 +30,8 @@ ruby:
30
30
  buttons = buttons.uniq.join(' ')
31
31
  formatting = formatting.uniq.join(' ')
32
32
 
33
+ = wcms_component "shared/embedded_image_uploader"
34
+
33
35
  - if form
34
36
  = form.text_area attribute, class: input_class, 'data-buttons' => buttons, 'data-formatting' => formatting
35
37
  - else
@@ -1,5 +1,5 @@
1
1
  ruby:
2
- embedded_image_url ||= wcms_components_embedded_images_url
2
+ embedded_image_url ||= wcms_components_embedded_images_url(authenticity_token: form_authenticity_token)
3
3
 
4
4
  - if embedded_image_url
5
5
  javascript:
@@ -1,3 +1,3 @@
1
1
  module BiolaWcmsComponents
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -110,7 +110,7 @@ class PresentationDataEditor
110
110
  end
111
111
 
112
112
  def build_image_uploader(attribute, parent_keys)
113
- view.content_tag :div, class: 'form-group' do
113
+ view.content_tag :div, class: 'form-group type-image-uploader' do
114
114
  view.label_tag(attribute[:name]) +
115
115
  view.text_field_tag(
116
116
  form_name(parent_keys, attribute[:name]),
@@ -120,7 +120,10 @@ class PresentationDataEditor
120
120
  id: attribute_id(parent_keys, attribute[:name]),
121
121
  placeholder: "Drop image here"
122
122
  }
123
- )
123
+ ) +
124
+ view.content_tag(:div, class: 'image_preview') do
125
+ view.image_tag data_grab(parent_keys, attribute[:name])
126
+ end
124
127
  end
125
128
  end
126
129
 
@@ -1,3 +1,7 @@
1
+ /* ON CHANGE:
2
+ remove the .redactor-toolbar z-index;
3
+ */
4
+
1
5
  /*
2
6
  Icon font
3
7
  */
@@ -51,14 +55,11 @@
51
55
  z-index: auto !important;
52
56
  }
53
57
  .redactor-box-fullscreen {
54
- z-index: 5000 !important;
55
- /*z-index: 1052 !important;
56
- Changed by Ryan -> This needs to be above other toolbars
57
- */
58
+ z-index: 1052 !important;
58
59
  }
59
60
  .redactor-toolbar,
60
61
  .redactor-dropdown {
61
- z-index: 1053 !important;
62
+ /*z-index: 1053 !important; -- [Ryan] This get shown above a lot of things. */
62
63
  }
63
64
  #redactor-modal-overlay,
64
65
  #redactor-modal-box,
@@ -110,6 +111,7 @@ body .redactor-box-fullscreen {
110
111
  font-family: Arial, Helvetica, Verdana, Tahoma, sans-serif;
111
112
  font-size: 14px;
112
113
  line-height: 1.6em;
114
+ border-radius: 0 0 4px 4px; /* [Ryan] - added */
113
115
  }
114
116
  .redactor-editor:focus {
115
117
  outline: none;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biola_wcms_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Hall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-06 00:00:00.000000000 Z
11
+ date: 2015-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ace-rails-ap