scrivito_text_image_widget 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +4 -0
- data/README.md +43 -0
- data/Rakefile +24 -0
- data/app/assets/images/widgets/scrivito_text_image_widget.png +0 -0
- data/app/assets/stylesheets/scrivito_text_image_widget.scss +78 -0
- data/app/models/text_image_widget.rb +25 -0
- data/app/views/text_image_widget/details.html.erb +19 -0
- data/app/views/text_image_widget/show.html.erb +10 -0
- data/app/views/text_image_widget/thumbnail.html.erb +3 -0
- data/lib/scrivito_text_image_widget.rb +4 -0
- data/lib/scrivito_text_image_widget/engine.rb +5 -0
- data/lib/scrivito_text_image_widget/version.rb +3 -0
- data/lib/tasks/scrivito_text_image_widget_tasks.rake +4 -0
- metadata +73 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 36f0a6bfc23fcf0a8bb40f84df4afd9ea92bad1c
|
4
|
+
data.tar.gz: f8916e2d5603d3893a9919040325d2666c5ffafb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9aa6c0f1e5bc839d033ad1112be05d46b867a071ce3267308af5a60d3b03c4132d18ec75b7230813f25b3ff90309d419fe2b031c183c6ef7f0fad1ed106ce989
|
7
|
+
data.tar.gz: 826b246d5475126e7a86a64ed714d41434bfa56960cdaa544e569a20182ca8c88c232c054ffb608ac4824dfe03eee06bd166fae5a7b2212ddf557db68e742668
|
data/LICENSE
ADDED
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# ScrivitoTextImageWidget
|
2
|
+
|
3
|
+
Scrivito Widget to add a text image widget with editable floating, image description and styleoptions.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'scrivito_text_image_widget'
|
10
|
+
|
11
|
+
Add this line to your application stylesheet manifest:
|
12
|
+
|
13
|
+
*= require scrivito_text_image_widget
|
14
|
+
|
15
|
+
## Localization
|
16
|
+
|
17
|
+
The following code represents the default localization for English. Copy it to your `en.yml` and change it if necessary:
|
18
|
+
|
19
|
+
```yaml
|
20
|
+
en:
|
21
|
+
scrivito_text_image_widget:
|
22
|
+
thumbnail:
|
23
|
+
title: Text Image
|
24
|
+
description: Insert a Image with floating Text
|
25
|
+
details:
|
26
|
+
floating: Floating
|
27
|
+
image_size: Image Size
|
28
|
+
image_size_mobile: Image Size Mobile
|
29
|
+
alt_text: Alternative Text
|
30
|
+
background_color: Background color
|
31
|
+
```
|
32
|
+
|
33
|
+
## Customization
|
34
|
+
|
35
|
+
This widget includes an attribute for the background color of every panel. The value of this attribute is used as a CSS class. If you want to use this feature, add a CSS rule for your selectable colors:
|
36
|
+
|
37
|
+
```css
|
38
|
+
.bg-red {
|
39
|
+
background-color: red;
|
40
|
+
}
|
41
|
+
```
|
42
|
+
|
43
|
+
You can also use the [Scrivito Advanced Editors](https://github.com/Scrivito/scrivito_advanced_editors #color_picker) color picker to have a better visualization of the selectable color classes.
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'ScrivitoTextImageWidget'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
load 'rails/tasks/statistics.rake'
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
Bundler::GemHelper.install_tasks
|
24
|
+
|
Binary file
|
@@ -0,0 +1,78 @@
|
|
1
|
+
.scrivito-text-image-image {
|
2
|
+
margin: 0;
|
3
|
+
padding: 0;
|
4
|
+
max-width: 100%;
|
5
|
+
}
|
6
|
+
|
7
|
+
.scrivito-text-image-image img {
|
8
|
+
max-width: 100%;
|
9
|
+
}
|
10
|
+
|
11
|
+
.scrivito-text-image-image .scrivito-text-image-description {
|
12
|
+
margin: 3px 0 10px;
|
13
|
+
padding: 10px;
|
14
|
+
font-size: 0.7em;
|
15
|
+
line-height: 0.7em;
|
16
|
+
p:last-child {
|
17
|
+
margin-bottom: 0;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
.scrivito-text-image-float-left {
|
22
|
+
float: left;
|
23
|
+
margin-right: 10px;
|
24
|
+
}
|
25
|
+
|
26
|
+
.scrivito-text-image-float-center {
|
27
|
+
float: none;
|
28
|
+
margin: auto;
|
29
|
+
}
|
30
|
+
|
31
|
+
.scrivito-text-image-float-right {
|
32
|
+
float: right;
|
33
|
+
margin-left: 10px;
|
34
|
+
}
|
35
|
+
|
36
|
+
.scrivito-text-image-size-small {
|
37
|
+
width: 100px;
|
38
|
+
}
|
39
|
+
|
40
|
+
.scrivito-text-image-size-medium {
|
41
|
+
width: 200px;
|
42
|
+
}
|
43
|
+
|
44
|
+
.scrivito-text-image-size-large {
|
45
|
+
width: 300px;
|
46
|
+
}
|
47
|
+
|
48
|
+
.scrivito-text-image-size-very-large {
|
49
|
+
width: 300px;
|
50
|
+
}
|
51
|
+
|
52
|
+
.scrivito-text-image-size-full {
|
53
|
+
width: 100%;
|
54
|
+
float: none;
|
55
|
+
}
|
56
|
+
|
57
|
+
@media(max-width: 750px) {
|
58
|
+
.scrivito-text-image-mobile-size-small {
|
59
|
+
width: 100px;
|
60
|
+
}
|
61
|
+
|
62
|
+
.scrivito-text-image-mobile-size-medium {
|
63
|
+
width: 200px;
|
64
|
+
}
|
65
|
+
|
66
|
+
.scrivito-text-image-mobile-size-large {
|
67
|
+
width: 300px;
|
68
|
+
}
|
69
|
+
|
70
|
+
.scrivito-text-image-size-very-large {
|
71
|
+
width: 500px;
|
72
|
+
}
|
73
|
+
|
74
|
+
.scrivito-text-image-mobile-size-large {
|
75
|
+
width: 100%;
|
76
|
+
float: none;
|
77
|
+
}
|
78
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class TextImageWidget < Widget
|
2
|
+
attribute :text, :html
|
3
|
+
attribute :image, :reference
|
4
|
+
attribute :image_description, :html
|
5
|
+
attribute :alt_text, :string
|
6
|
+
attribute :floating, :enum, values: ['left','center','right'], default: 'left'
|
7
|
+
attribute :image_size, :enum, values: ['small','medium','large', 'very-large', 'full'], default: 'medium'
|
8
|
+
attribute :image_size_mobile, :enum, values: ['small','medium','large', 'very-large','full'], default: 'medium'
|
9
|
+
attribute :background_color, :string
|
10
|
+
|
11
|
+
def image_floating_class
|
12
|
+
"scrivito-text-image-float-#{floating}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def image_size_class
|
16
|
+
"scrivito-text-image-size-#{image_size} scrivito-text-image-mobile-size-#{image_size_mobile}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def scrivito_selectable_color_classes
|
20
|
+
helper = ApplicationController.helpers
|
21
|
+
if helper.respond_to? 'scrivito_selectable_color_classes'
|
22
|
+
helper.scrivito_selectable_color_classes('accordion_widget', 'background_color')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= scrivito_details_for t('scrivito_text_image_widget.details.floating', default: 'Floating') do %>
|
2
|
+
<%= scrivito_tag :div, widget, :floating %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<%= scrivito_details_for t('scrivito_text_image_widget.details.image_size', default: 'Image Size') do %>
|
6
|
+
<%= scrivito_tag :div, widget, :image_size %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<%= scrivito_details_for t('scrivito_text_image_widget.details.image_size_monile', default: 'Image Size Mobile') do %>
|
10
|
+
<%= scrivito_tag :div, widget, :image_size_mobile %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= scrivito_details_for t('scrivito_text_image_widget.details.alt_text', default: 'Alternative Text') do %>
|
14
|
+
<%= scrivito_tag :div, widget, :alt_text %>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= scrivito_details_for t('scrivito_text_image_widget.details.background_color', default: 'Background Color') do %>
|
18
|
+
<%= scrivito_tag :div, widget, :background_color, data: {colors_list: widget.scrivito_selectable_color_classes} %>
|
19
|
+
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<div class="scrivito-text-image-widget">
|
2
|
+
<div class="scrivito-text-image-image <%= widget.image_floating_class %> <%= widget.image_size_class %>">
|
3
|
+
<%= scrivito_image_tag widget, :image, class: "", alt: widget.alt_text %>
|
4
|
+
<% if widget.image_description.present? || scrivito_in_editable_view? %>
|
5
|
+
<%= scrivito_tag :div, widget, :image_description, class: "scrivito-text-image-description #{widget.background_color}" %>
|
6
|
+
<% end %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<%= scrivito_tag :div, widget, :text, class: 'scrivito-text-image-text' %>
|
10
|
+
</div>
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: scrivito_text_image_widget
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Scrivito
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: scrivito
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Scrivito Widget to add a text image widget with editable floating, image
|
28
|
+
description and styleoptions.
|
29
|
+
email:
|
30
|
+
- support@scrivito.com
|
31
|
+
executables: []
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- LICENSE
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- app/assets/images/widgets/scrivito_text_image_widget.png
|
39
|
+
- app/assets/stylesheets/scrivito_text_image_widget.scss
|
40
|
+
- app/models/text_image_widget.rb
|
41
|
+
- app/views/text_image_widget/details.html.erb
|
42
|
+
- app/views/text_image_widget/show.html.erb
|
43
|
+
- app/views/text_image_widget/thumbnail.html.erb
|
44
|
+
- lib/scrivito_text_image_widget.rb
|
45
|
+
- lib/scrivito_text_image_widget/engine.rb
|
46
|
+
- lib/scrivito_text_image_widget/version.rb
|
47
|
+
- lib/tasks/scrivito_text_image_widget_tasks.rake
|
48
|
+
homepage: https://www.scrivito.com
|
49
|
+
licenses:
|
50
|
+
- LGPL-3.0
|
51
|
+
metadata: {}
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 2.4.5
|
69
|
+
signing_key:
|
70
|
+
specification_version: 4
|
71
|
+
summary: Scrivito Widget to add a text image widget with editable floating, image
|
72
|
+
description and styleoptions.
|
73
|
+
test_files: []
|