biola_wcms_components 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/components/forms/presentation_data_editor.js.coffee +5 -0
- data/app/assets/javascripts/configuration/setup_redactor.js.coffee +6 -1
- data/app/assets/stylesheets/components/forms/_presentation_data_editor.scss +3 -0
- data/app/controllers/wcms_components/embedded_images_controller.rb +1 -1
- data/app/views/wcms_components/forms/_person_lookup.html.slim +15 -3
- data/app/views/wcms_components/forms/_redactor_editor.html.slim +2 -0
- data/app/views/wcms_components/shared/_embedded_image_uploader.html.slim +1 -1
- data/lib/biola_wcms_components/version.rb +1 -1
- data/lib/components/presentation_data_editor.rb +5 -2
- data/vendor/assets/stylesheets/redactor.css +7 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8923842f9aa5259010d882588b06970b3bfd005
|
4
|
+
data.tar.gz: af976f1cb38616b4424f28583c1f73af615c3e58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
@@ -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,
|
16
|
-
= text_field_tag :person_name,
|
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
|
@@ -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:
|
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.
|
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-
|
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
|