scrivito_content_box_widget 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a5839b081f521683368bb142035bfdcaa1967f9e
4
+ data.tar.gz: 4894e3c814dfb8bacabc2167598c049434e80a75
5
+ SHA512:
6
+ metadata.gz: 53371eb7cd5d7bf96c9d9adc3180446c61b9671c1e84d579dfbb294ec59db0625ede83894693d152090e9628734e3c2520149895b30055aff67aa945defbe839
7
+ data.tar.gz: dd9473afa03d48e79bf2575f9cd1a54f170aca9d84c9dc9161fa48bea92cac8a916691dd30e50f1b17212f6659b44359871e1d0373b7372a2ed08ea678438608
data/LICENSE ADDED
@@ -0,0 +1,4 @@
1
+ Copyright (c) 2009 - 2016 Infopark AG (http://www.infopark.com)
2
+
3
+ This software can be used and modified under the LGPL-3.0. Please refer to
4
+ http://www.gnu.org/licenses/lgpl-3.0.html for the license text.
@@ -0,0 +1,79 @@
1
+ # ScrivitoContentBoxWidget
2
+
3
+ Scrivito Widget to add a content box with adjustable background color.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'scrivito_content_box_widget'
10
+
11
+ Add this line to your application stylesheet manifest:
12
+
13
+ *= require scrivito_content_box_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_content_box_widget:
22
+ thumbnail:
23
+ title: Content Box
24
+ description: Add a content box to our page where you can set a background color and different styles
25
+ details:
26
+ background_color: Background color
27
+ styles: Styles
28
+ ```
29
+
30
+ ## Customization
31
+
32
+ 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:
33
+
34
+ ```css
35
+ .bg-red {
36
+ background-color: red;
37
+ }
38
+ ```
39
+
40
+ 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.
41
+
42
+ There is also an attribute for different styles. It holds a class for different styles like `drop_shadow`, `more_margin`, `highlight`, ...
43
+
44
+ Using advance editors, you can define the selectable classes by adding a class method to your `obj.rb`:
45
+
46
+ ```ruby
47
+ class Obj < Scrivito::BasicObj
48
+ ...
49
+ def scrivito_selectable_style_classes
50
+ ['drop_shadow','margin_top','move_left','highlight', 'rounded']
51
+ end
52
+ ...
53
+ end
54
+ ```
55
+
56
+ Than you have to define a css class for your selections:
57
+
58
+ ```css
59
+ .drop_shadow {
60
+ box-shadow: 0 2px 6px 1px rgba(0, 0, 0, 0.3);
61
+ }
62
+
63
+ .margin_top {
64
+ margin-top: 10px;
65
+ }
66
+
67
+ .move_left {
68
+ width: auto;
69
+ margin-left: -20px;
70
+ }
71
+
72
+ .highlight {
73
+ outline: #cc0000 solid 3px;
74
+ }
75
+
76
+ .rounded {
77
+ border-radius: 5px;
78
+ }
79
+ ```
@@ -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 = 'ScrivitoContentBoxWidget'
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
+
@@ -0,0 +1,24 @@
1
+ .scrivito-content-box-widget {
2
+ width: 100%;
3
+ padding: 10px;
4
+ &.drop_shadow {
5
+ box-shadow: 0 2px 6px 1px rgba(0, 0, 0, 0.3);
6
+ }
7
+
8
+ &.margin_top {
9
+ margin-top: 10px;
10
+ }
11
+
12
+ &.move_left {
13
+ width: auto;
14
+ margin-left: -20px;
15
+ }
16
+
17
+ &.highlight {
18
+ outline: #cc0000 solid 3px;
19
+ }
20
+
21
+ &.rounded {
22
+ border-radius: 5px;
23
+ }
24
+ }
@@ -0,0 +1,20 @@
1
+ class ContentBoxWidget < Widget
2
+ attribute :background_color, :string
3
+ attribute :content, :widgetlist
4
+ attribute :styles, :stringlist
5
+
6
+ def scrivito_selectable_color_classes
7
+ helper = ApplicationController.helpers
8
+ if helper.respond_to? 'scrivito_selectable_color_classes'
9
+ helper.scrivito_selectable_color_classes('content_box_widget', 'background_color')
10
+ end
11
+ end
12
+
13
+ def scrivito_selectable_style_classes
14
+ if Obj.respond_to? 'scrivito_selectable_style_classes'
15
+ Obj.scrivito_selectable_style_classes
16
+ else
17
+ ['drop_shadow','margin_top','move_left','highlight', 'rounded']
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,7 @@
1
+ <%= scrivito_details_for t('scrivito_content_box_widget.details.background_color', default: 'Background Color') do %>
2
+ <%= scrivito_tag :div, widget, :background_color, data: {colors_list: widget.scrivito_selectable_color_classes} %>
3
+ <% end %>
4
+
5
+ <%= scrivito_details_for t('scrivito_content_box_widget.details.styles', default: 'Styles') do %>
6
+ <%= scrivito_tag :div, widget, :styles, data: {multi_select_list: widget.scrivito_selectable_style_classes} %>
7
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <div class="scrivito-content-box-widget <%= widget.background_color %> <%= widget.styles.join(' ') %>">
2
+ <%= scrivito_tag :div, widget, :content, class: "scrivito-content-box-widget-content" %>
3
+ </div>
@@ -0,0 +1,3 @@
1
+ <%= scrivito_thumbnail t('scrivito_content_box_widget.thumbnail.title', default: 'Content Box'), image_tag("widgets/scrivito_content_box_widget.png") do %>
2
+ <%= t('scrivito_content_box_widget.thumbnail.description', default: 'Add a content box to our page where you can set a background color and different styles') %>
3
+ <% end %>
@@ -0,0 +1,4 @@
1
+ require "scrivito_content_box_widget/engine"
2
+
3
+ module ScrivitoContentBoxWidget
4
+ end
@@ -0,0 +1,5 @@
1
+ module ScrivitoContentBoxWidget
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace ScrivitoContentBoxWidget
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module ScrivitoContentBoxWidget
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :scrivito_content_box_widget do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scrivito_content_box_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_sdk
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 content box with adjustable background color.
28
+ email:
29
+ - support@scrivito.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - LICENSE
35
+ - README.md
36
+ - Rakefile
37
+ - app/assets/images/widgets/scrivito_content_box_widget.png
38
+ - app/assets/stylesheets/scrivito_content_box_widget.scss
39
+ - app/models/content_box_widget.rb
40
+ - app/views/content_box_widget/details.html.erb
41
+ - app/views/content_box_widget/show.html.erb
42
+ - app/views/content_box_widget/thumbnail.html.erb
43
+ - lib/scrivito_content_box_widget.rb
44
+ - lib/scrivito_content_box_widget/engine.rb
45
+ - lib/scrivito_content_box_widget/version.rb
46
+ - lib/tasks/scrivito_content_box_widget_tasks.rake
47
+ homepage: https://www.scrivito.com
48
+ licenses:
49
+ - LGPL-3.0
50
+ metadata: {}
51
+ post_install_message:
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubyforge_project:
67
+ rubygems_version: 2.4.5
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: Scrivito Widget to add a content box with adjustable background color.
71
+ test_files: []