scrivito_two_column_widget 0.90.0 → 1.0.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 +4 -4
- data/README.md +21 -5
- data/app/assets/stylesheets/scritivo_two_column_widget.scss +39 -0
- data/app/models/two_column_widget.rb +14 -0
- data/app/views/two_column_widget/details.html.erb +12 -1
- data/app/views/two_column_widget/show.html.erb +5 -5
- data/app/views/two_column_widget/thumbnail.html.erb +2 -2
- data/lib/scrivito_two_column_widget/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0d5c4ed1a3c3148a8625fe58c20be0f2ba9c344
|
4
|
+
data.tar.gz: 3c40819e31b9a24f673e3d3d6d2a396fda67d0b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8700fa0887a6ae159ac6630eadb70ef1a7864149cfd66ba93fe989e249d062832a578c1954554fcf2053d3db7f8b5ab21b819d60e04418593e51ed485f88b2c9
|
7
|
+
data.tar.gz: 9d684f14889a8646438ea45eb5546ceef1aaeaddeb9e380448df8faa79054ed1dae222d6d7955fb8281ebac5fbbf502007274bed5b310093fc4bc7da142f5e51
|
data/README.md
CHANGED
@@ -1,17 +1,33 @@
|
|
1
|
-
#
|
1
|
+
# ScrivitoTwoColumnWidget
|
2
2
|
|
3
|
-
This
|
3
|
+
This gem adds a Scrivito widget for dividing pages and page sections into two columns to your app.
|
4
4
|
|
5
5
|
## Prerequisites
|
6
6
|
|
7
|
-
|
7
|
+
Requires Bootstrap in your Rails App.
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
|
-
Add
|
11
|
+
Add this line to your application's Gemfile:
|
12
12
|
|
13
13
|
gem 'scrivito_two_column_widget'
|
14
14
|
|
15
15
|
## Customization
|
16
16
|
|
17
|
-
We
|
17
|
+
We recommend to use [Scrivito Advanced Editors](https://github.com/Scrivito/scrivito_advanced_editors) which provides nicer controls.
|
18
|
+
|
19
|
+
## Localization
|
20
|
+
|
21
|
+
The following code represents the default localization for English. Copy it to your `en.yml` and change it if necessary:
|
22
|
+
|
23
|
+
```yaml
|
24
|
+
en:
|
25
|
+
scrivito_two_column_widget:
|
26
|
+
thumbnail:
|
27
|
+
title: Two Columns
|
28
|
+
description: Two columns that can be filled with widgets
|
29
|
+
details:
|
30
|
+
column_1_width: Width for column 1
|
31
|
+
grid_size: Gird Size
|
32
|
+
keep_columns: Show columns on mobile
|
33
|
+
```
|
@@ -0,0 +1,39 @@
|
|
1
|
+
.scrivito-column-widget.small-grid {
|
2
|
+
margin-left: 0;
|
3
|
+
margin-right: 0;
|
4
|
+
.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1,
|
5
|
+
.col-xs-2, .col-sm-2, .col-md-2, .col-lg-2,
|
6
|
+
.col-xs-3, .col-sm-3, .col-md-3, .col-lg-3,
|
7
|
+
.col-xs-4, .col-sm-4, .col-md-4, .col-lg-4,
|
8
|
+
.col-xs-5, .col-sm-5, .col-md-5, .col-lg-5,
|
9
|
+
.col-xs-6, .col-sm-6, .col-md-6, .col-lg-6,
|
10
|
+
.col-xs-7, .col-sm-7, .col-md-7, .col-lg-7,
|
11
|
+
.col-xs-8, .col-sm-8, .col-md-8, .col-lg-8,
|
12
|
+
.col-xs-9, .col-sm-9, .col-md-9, .col-lg-9,
|
13
|
+
.col-xs-10, .col-sm-10, .col-md-10, .col-lg-10,
|
14
|
+
.col-xs-11, .col-sm-11, .col-md-11, .col-lg-11,
|
15
|
+
.col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
|
16
|
+
padding-left: 0px;
|
17
|
+
padding-right: 0px;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
.scrivito-column-widget.large-grid {
|
22
|
+
margin-left: -30px;
|
23
|
+
margin-right: -30px;
|
24
|
+
.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1,
|
25
|
+
.col-xs-2, .col-sm-2, .col-md-2, .col-lg-2,
|
26
|
+
.col-xs-3, .col-sm-3, .col-md-3, .col-lg-3,
|
27
|
+
.col-xs-4, .col-sm-4, .col-md-4, .col-lg-4,
|
28
|
+
.col-xs-5, .col-sm-5, .col-md-5, .col-lg-5,
|
29
|
+
.col-xs-6, .col-sm-6, .col-md-6, .col-lg-6,
|
30
|
+
.col-xs-7, .col-sm-7, .col-md-7, .col-lg-7,
|
31
|
+
.col-xs-8, .col-sm-8, .col-md-8, .col-lg-8,
|
32
|
+
.col-xs-9, .col-sm-9, .col-md-9, .col-lg-9,
|
33
|
+
.col-xs-10, .col-sm-10, .col-md-10, .col-lg-10,
|
34
|
+
.col-xs-11, .col-sm-11, .col-md-11, .col-lg-11,
|
35
|
+
.col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
|
36
|
+
padding-left: 30px;
|
37
|
+
padding-right: 30px;
|
38
|
+
}
|
39
|
+
}
|
@@ -2,9 +2,23 @@ class TwoColumnWidget < Widget
|
|
2
2
|
attribute :column_1, :widgetlist
|
3
3
|
attribute :column_2, :widgetlist
|
4
4
|
attribute :column_1_width, :enum, values: (1..12).to_a.map {|e| e.to_s}, default: '6'
|
5
|
+
attribute :grid_size, :enum, values: ['small','default','large'], default: 'default'
|
6
|
+
attribute :keep_columns, :enum, values: ['Yes','No'], default: 'No'
|
5
7
|
|
6
8
|
def column_2_width
|
9
|
+
val = column_2_width_value
|
10
|
+
val < 1 ? 1 : val
|
11
|
+
end
|
12
|
+
|
13
|
+
def column_2_width_value
|
7
14
|
12 - self.column_1_width.to_i
|
8
15
|
end
|
9
16
|
|
17
|
+
def grid_size_class
|
18
|
+
"#{grid_size || 'default'}-grid"
|
19
|
+
end
|
20
|
+
|
21
|
+
def device_class
|
22
|
+
keep_columns == 'Yes' ? 'xs' : 'md'
|
23
|
+
end
|
10
24
|
end
|
@@ -1,3 +1,14 @@
|
|
1
1
|
<%= scrivito_details_for 'column 1' do %>
|
2
2
|
<%= scrivito_tag(:div, widget, :column_1_width) %>
|
3
|
-
<% end %>
|
3
|
+
<% end %>
|
4
|
+
<%= scrivito_details_for t('scrivito_two_column_widget.details.column_1_width', default: 'Width for column 1') do %>
|
5
|
+
<%= scrivito_tag(:div, widget, :column_1_width) %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<%= scrivito_details_for t('scrivito_two_column_widget.details.grid_size', default: 'Grid Size') do %>
|
9
|
+
<%= scrivito_tag(:div, widget, :grid_size) %>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= scrivito_details_for t('scrivito_two_column_widget.details.keep_columns', default: 'Show columns on mobile') do %>
|
13
|
+
<%= scrivito_tag(:div, widget, :keep_columns) %>
|
14
|
+
<% end %>
|
@@ -1,9 +1,9 @@
|
|
1
|
-
<div class="row">
|
2
|
-
<div class="col
|
3
|
-
<%= scrivito_tag(:div, widget, :column_1
|
1
|
+
<div class="scrivito-column-widget row <%= widget.grid_size_class %>">
|
2
|
+
<div class="col-<%= widget.device_class %>-<%= widget.column_1_width %>">
|
3
|
+
<%= scrivito_tag(:div, widget, :column_1) %>
|
4
4
|
</div>
|
5
5
|
|
6
|
-
<div class="col
|
7
|
-
<%= scrivito_tag(:div, widget, :column_2
|
6
|
+
<div class="col-<%= widget.device_class %>-<%= widget.column_2_width %>">
|
7
|
+
<%= scrivito_tag(:div, widget, :column_2) %>
|
8
8
|
</div>
|
9
9
|
</div>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<%= scrivito_thumbnail '
|
2
|
-
Two columns that can be filled with widgets
|
1
|
+
<%= scrivito_thumbnail t('scrivito_two_column_widget.thumbnail.title', default: 'Three Coumns'), image_tag("scrivito_two_column_widget/widget_preview_2cols.png") do %>
|
2
|
+
<%= t('scrivito_two_column_widget.thumbnail.description', default: 'Two columns that can be filled with widgets') %>
|
3
3
|
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrivito_two_column_widget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scrivito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: scrivito
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- README.md
|
36
36
|
- Rakefile
|
37
37
|
- app/assets/images/scrivito_two_column_widget/widget_preview_2cols.png
|
38
|
+
- app/assets/stylesheets/scritivo_two_column_widget.scss
|
38
39
|
- app/models/two_column_widget.rb
|
39
40
|
- app/views/two_column_widget/details.html.erb
|
40
41
|
- app/views/two_column_widget/show.html.erb
|