scrivito_tabbed_content_widget 0.0.60 → 0.0.65
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/LICENSE +1 -1
- data/README.md +5 -28
- data/app/assets/javascripts/scrivito_tabbed_content_widget.js +21 -0
- data/app/assets/stylesheets/scrivito_tabbed_content_widget.css +35 -0
- data/app/models/tabbed_content_tab_widget.rb +13 -9
- data/app/models/tabbed_content_widget.rb +9 -39
- data/app/views/tabbed_content_tab_widget/details.html.erb +10 -0
- data/app/views/tabbed_content_widget/details.html.erb +3 -0
- data/app/views/tabbed_content_widget/show.html.erb +14 -0
- data/app/views/tabbed_content_widget/thumbnail.html.erb +3 -0
- data/lib/scrivito_tabbed_content_widget/version.rb +1 -1
- metadata +9 -16
- data/app/assets/javascripts/scrivito_tabbed_content_widget/application.js +0 -13
- data/app/assets/javascripts/scrivito_tabbed_content_widget/editing.js +0 -8
- data/app/assets/stylesheets/scrivito_tabbed_content_widget/application.css +0 -15
- data/app/assets/stylesheets/scrivito_tabbed_content_widget/editing.css +0 -2
- data/app/controllers/scrivito_tabbed_content_widget/tabbed_content_widget_controller.rb +0 -16
- data/app/views/layouts/scrivito_tabbed_content_widget/application.html.erb +0 -14
- data/app/views/tabbed_content_tab_widget/details.html.haml +0 -5
- data/app/views/tabbed_content_tab_widget/show.html.haml +0 -2
- data/app/views/tabbed_content_tab_widget/thumbnail.html.haml +0 -10
- data/app/views/tabbed_content_widget/add_new_tab.html.haml +0 -1
- data/app/views/tabbed_content_widget/details.html.haml +0 -5
- data/app/views/tabbed_content_widget/show.html.haml +0 -27
- data/app/views/tabbed_content_widget/thumbnail.html.haml +0 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0f8d256e378c379cc6fe5937a27b970435edfccc
|
|
4
|
+
data.tar.gz: 06f491fbb0bd7e26e25075375ffca976dd9526f7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 584db0f18f4566444de634e8f1cce96d4f8293efe0f02b4ea1016c04ecc7063b08e1ab7ec1b6cb6b16c548e341b6044d5dfa3fe0ae87e5066f3f6dbeb3cdb8ba
|
|
7
|
+
data.tar.gz: 052609d6d2fb26f65047c9ff503549e69314a5f017e67a14f8f624bddc9fa76a4d54276247c0111fb9f1272158a47a017ef3efa7e9a9f374a344a6a8494e9f94
|
data/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c) 2009 -
|
|
1
|
+
Copyright (c) 2009 - 2015 Infopark AG (http://www.infopark.com)
|
|
2
2
|
|
|
3
3
|
This software can be used and modified under the LGPL-3.0. Please refer to
|
|
4
4
|
http://www.gnu.org/licenses/lgpl-3.0.html for the license text.
|
data/README.md
CHANGED
|
@@ -2,45 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
This Gem adds Tabbed Contents to your app. Fill the Gem with Tabs and fill each tab with a widget.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
## Prerequisites
|
|
7
|
-
|
|
8
|
-
Use Bootstrap in your Rails App. (Tested with Bootstrap 3.2)
|
|
9
|
-
Use Haml in your Rails App.
|
|
10
|
-
|
|
11
|
-
|
|
12
5
|
## Installation
|
|
13
6
|
|
|
14
7
|
Add the gem to your Gemfile:
|
|
15
8
|
|
|
16
9
|
gem 'scrivito_tabbed_content_widget'
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
$ bundle
|
|
21
|
-
|
|
22
|
-
Add this line to your application's editing.js
|
|
23
|
-
|
|
24
|
-
//= require scrivito_tabbed_content_widget/editing
|
|
25
|
-
|
|
26
|
-
Run
|
|
27
|
-
|
|
28
|
-
$ rake scrivito:migrate:install
|
|
29
|
-
$ rake scrivito:migrate
|
|
30
|
-
|
|
31
|
-
Switch to your Workspace 'rtc' and follow below Steps for Usage. If you are happy with the outcome run
|
|
32
|
-
|
|
33
|
-
$ rake scrivito:migrate:publish
|
|
11
|
+
Add this line to your applications stylesheet manifest
|
|
34
12
|
|
|
13
|
+
*= require scrivito_tabbed_content_widget
|
|
35
14
|
|
|
36
|
-
|
|
15
|
+
Add this line to your applications javascript manifest
|
|
37
16
|
|
|
38
|
-
|
|
39
|
-
- Put some 'Tabbed Content Tab' widgets into it.
|
|
40
|
-
- For each of the Tabbed Content Tabs: set a headline and fill the content with any widget (text, images, whatever).
|
|
17
|
+
//= require scrivito_tabbed_content_widget
|
|
41
18
|
|
|
42
19
|
## License
|
|
43
20
|
|
|
44
|
-
Copyright (c) 2009 -
|
|
21
|
+
Copyright (c) 2009 - 2015 Infopark AG (http://www.infopark.com)
|
|
45
22
|
|
|
46
23
|
This software can be used and modified under the LGPL-3.0. Please refer to http://www.gnu.org/licenses/lgpl-3.0.html for the license text.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
(function($, App) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
$(function() {
|
|
5
|
+
scrivito.on('content', function(content) {
|
|
6
|
+
$(content).find('.scrivito-tab-group').each(function(i, tab_group) {
|
|
7
|
+
tab_group = $(tab_group);
|
|
8
|
+
tab_group.find('.scrivito-tab-title').each(function(i, tab_title) {
|
|
9
|
+
tab_title = $(tab_title);
|
|
10
|
+
tab_title.click(function() {
|
|
11
|
+
tab_group.find('.scrivito-tab-title').removeClass('scrivito-tab-active');
|
|
12
|
+
tab_title.addClass('scrivito-tab-active');
|
|
13
|
+
tab_group.find('.scrivito-tab-content').removeClass('scrivito-tab-active');
|
|
14
|
+
tab_group.find('.scrivito-tab-content').eq(tab_title.index())
|
|
15
|
+
.addClass('scrivito-tab-active');
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
})(jQuery, this);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.scrivito-tab-group .scrivito-tab-titles {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.scrivito-tab-group .scrivito-tab-titles .scrivito-tab-title {
|
|
6
|
+
float: left;
|
|
7
|
+
padding: 10px 50px;
|
|
8
|
+
background: #eee;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.scrivito-tab-group .scrivito-tab-titles .scrivito-tab-title:hover {
|
|
13
|
+
background: #ccc;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.scrivito-tab-group .scrivito-tab-titles .scrivito-tab-title.scrivito-tab-active {
|
|
17
|
+
background: #ddd;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.scrivito-tab-group .scrivito-tab-contents .scrivito-tab-content {
|
|
21
|
+
display: none;
|
|
22
|
+
min-height: 100px!important;
|
|
23
|
+
padding: 10px;
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.scrivito-tab-group .scrivito-tab-contents .scrivito-tab-content.scrivito-tab-active {
|
|
28
|
+
display: block;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@media (max-width: 600px) {
|
|
32
|
+
.scrivito-tab-group .scrivito-tab-titles .scrivito-tab-title {
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
class TabbedContentTabWidget < Widget
|
|
2
|
+
attribute :title, :string, default: 'New Tab'
|
|
2
3
|
attribute :content, :widgetlist
|
|
3
|
-
attribute :headline, :string
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
self.container.respond_to?("tabs") && self.container.tabs.first == self ? "active" : ""
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def description_for_editor
|
|
10
|
-
"Tab"
|
|
11
|
-
end
|
|
5
|
+
attribute :background_color, :string
|
|
12
6
|
|
|
13
7
|
def self.valid_container_classes
|
|
14
8
|
[TabbedContentWidget]
|
|
15
9
|
end
|
|
16
10
|
|
|
17
|
-
|
|
11
|
+
def self.description_for_editor
|
|
12
|
+
'Tab'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def classes(index)
|
|
16
|
+
css = ["scrivito-tab-title"]
|
|
17
|
+
css << "scrivito-tab-active" if index == 0
|
|
18
|
+
css << self.background_color
|
|
19
|
+
css.join(" ")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -1,44 +1,14 @@
|
|
|
1
1
|
class TabbedContentWidget < Widget
|
|
2
|
-
attribute :tabs, :widgetlist
|
|
2
|
+
attribute :tabs, :widgetlist, default: [
|
|
3
|
+
TabbedContentTabWidget.new(title: 'First Tab'),
|
|
4
|
+
TabbedContentTabWidget.new(title: 'Second Tab')
|
|
5
|
+
]
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def self.valid_widget_classes_for(field_name)
|
|
7
|
-
%w[TabbedContentTabWidget]
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def description_for_editor
|
|
11
|
-
"Tabbed Content"
|
|
7
|
+
def valid_widget_classes_for(field_name)
|
|
8
|
+
[TabbedContentTabWidget]
|
|
12
9
|
end
|
|
13
10
|
|
|
14
|
-
def
|
|
15
|
-
|
|
16
|
-
missing_tabs.times do
|
|
17
|
-
_tabs << PlaceholderTabWidgetElement.new
|
|
18
|
-
end
|
|
19
|
-
_tabs
|
|
11
|
+
def self.description_for_editor
|
|
12
|
+
'Tab Group'
|
|
20
13
|
end
|
|
21
|
-
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
def missing_tabs
|
|
25
|
-
DEFAULT_TABS - tabs.size
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
class PlaceholderTabWidgetElement
|
|
29
|
-
|
|
30
|
-
def id
|
|
31
|
-
@id ||= SecureRandom.hex(2)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def headline
|
|
35
|
-
'Widget Placeholder'
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def content
|
|
39
|
-
[]
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<div class="scrivito-tab-title-details">
|
|
2
|
+
<%= scrivito_tag :h4, widget, :title %>
|
|
3
|
+
<%= link_to '(details)', '#', 'data-scrivito-tab-toggle-details' => widget.id %>
|
|
4
|
+
<div class="scrivito-tab-details-<%= widget.id %>">
|
|
5
|
+
<div>
|
|
6
|
+
<b>Background Color</b>
|
|
7
|
+
<%= render 'scrivito_advanced_editors/color_picker', widget: widget, attribute: :background_color %>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<div class="scrivito-tab-group">
|
|
2
|
+
<div class="scrivito-tab-titles">
|
|
3
|
+
<% widget.tabs.each_with_index do |tab, i| %>
|
|
4
|
+
<div class="<%= tab.classes(i) %>">
|
|
5
|
+
<%= scrivito_value tab.title %>
|
|
6
|
+
</div>
|
|
7
|
+
<% end %>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="scrivito-tab-contents">
|
|
10
|
+
<% widget.tabs.each_with_index do |tab, i| %>
|
|
11
|
+
<%= scrivito_tag :div, tab, :content, class: "scrivito-tab-content #{'scrivito-tab-active' if i == 0}" %>
|
|
12
|
+
<% end %>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: scrivito_tabbed_content_widget
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.65
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Scrivito
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-06-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: scrivito
|
|
@@ -63,21 +63,14 @@ files:
|
|
|
63
63
|
- README.md
|
|
64
64
|
- Rakefile
|
|
65
65
|
- app/assets/images/scrivito_tabbed_content_widget/widget_preview_tabbed.png
|
|
66
|
-
- app/assets/javascripts/scrivito_tabbed_content_widget
|
|
67
|
-
- app/assets/
|
|
68
|
-
- app/assets/stylesheets/scrivito_tabbed_content_widget/application.css
|
|
69
|
-
- app/assets/stylesheets/scrivito_tabbed_content_widget/editing.css
|
|
70
|
-
- app/controllers/scrivito_tabbed_content_widget/tabbed_content_widget_controller.rb
|
|
66
|
+
- app/assets/javascripts/scrivito_tabbed_content_widget.js
|
|
67
|
+
- app/assets/stylesheets/scrivito_tabbed_content_widget.css
|
|
71
68
|
- app/models/tabbed_content_tab_widget.rb
|
|
72
69
|
- app/models/tabbed_content_widget.rb
|
|
73
|
-
- app/views/
|
|
74
|
-
- app/views/
|
|
75
|
-
- app/views/
|
|
76
|
-
- app/views/
|
|
77
|
-
- app/views/tabbed_content_widget/add_new_tab.html.haml
|
|
78
|
-
- app/views/tabbed_content_widget/details.html.haml
|
|
79
|
-
- app/views/tabbed_content_widget/show.html.haml
|
|
80
|
-
- app/views/tabbed_content_widget/thumbnail.html.haml
|
|
70
|
+
- app/views/tabbed_content_tab_widget/details.html.erb
|
|
71
|
+
- app/views/tabbed_content_widget/details.html.erb
|
|
72
|
+
- app/views/tabbed_content_widget/show.html.erb
|
|
73
|
+
- app/views/tabbed_content_widget/thumbnail.html.erb
|
|
81
74
|
- config/routes.rb
|
|
82
75
|
- lib/scrivito_tabbed_content_widget.rb
|
|
83
76
|
- lib/scrivito_tabbed_content_widget/engine.rb
|
|
@@ -104,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
104
97
|
version: '0'
|
|
105
98
|
requirements: []
|
|
106
99
|
rubyforge_project:
|
|
107
|
-
rubygems_version: 2.4.
|
|
100
|
+
rubygems_version: 2.4.5
|
|
108
101
|
signing_key:
|
|
109
102
|
specification_version: 4
|
|
110
103
|
summary: A Scrivito Widget for tabbed content.
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
-
// listed below.
|
|
3
|
-
//
|
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
-
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
-
//
|
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
-
// compiled file.
|
|
9
|
-
//
|
|
10
|
-
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
|
11
|
-
// about supported directives.
|
|
12
|
-
//
|
|
13
|
-
//= require_tree .
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
$("#add_new_tab").bind("click", function(e) {
|
|
2
|
-
e.preventDefault();
|
|
3
|
-
$.get("/scrivito_tabbed_content_widget/add_new_tab?obj=" + $(this).attr("pageid") + "&widget=" + $(this).attr("widgetid"), function(data) {
|
|
4
|
-
// TBD: do not reload full page, only tabbed content widget and activate newly created tab
|
|
5
|
-
location.reload();
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
-
* listed below.
|
|
4
|
-
*
|
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
-
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
|
7
|
-
*
|
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any styles
|
|
10
|
-
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
|
11
|
-
* file per style scope.
|
|
12
|
-
*
|
|
13
|
-
*= require_tree .
|
|
14
|
-
*= require_self
|
|
15
|
-
*/
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module ScrivitoTabbedContentWidget
|
|
2
|
-
|
|
3
|
-
class TabbedContentWidgetController < CmsController
|
|
4
|
-
|
|
5
|
-
layout false
|
|
6
|
-
|
|
7
|
-
def add_new_tab
|
|
8
|
-
widget = Obj.find(params[:obj]).widget_from_pool(params[:widget])
|
|
9
|
-
widget.update(tabs: widget.tabs << TabbedContentTabWidget.new())
|
|
10
|
-
#TODO: check for success and return appropriate result
|
|
11
|
-
render "tabbed_content_widget/add_new_tab"
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>ScrivitoTabbedContentWidget</title>
|
|
5
|
-
<%= stylesheet_link_tag "scrivito_tabbed_content_widget/application", media: "all" %>
|
|
6
|
-
<%= javascript_include_tag "scrivito_tabbed_content_widget/application" %>
|
|
7
|
-
<%= csrf_meta_tags %>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
|
|
11
|
-
<%= yield %>
|
|
12
|
-
|
|
13
|
-
</body>
|
|
14
|
-
</html>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Done.
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
.tabs-wrapper
|
|
2
|
-
= scrivito_tag(:div, widget, :tabs, style: 'display:none')
|
|
3
|
-
|
|
4
|
-
%ul.nav.nav-tabs
|
|
5
|
-
- widget.tabs.each_with_index do |tab, index|
|
|
6
|
-
- active_class = index == 0 ? 'active' : nil
|
|
7
|
-
%li{class: active_class}
|
|
8
|
-
= scrivito_tag(:a, tab, :headline, href: "##{tab.id}", 'data-toggle' => 'tab')
|
|
9
|
-
|
|
10
|
-
- if scrivito_in_editable_view?
|
|
11
|
-
%li.new_tab
|
|
12
|
-
%a{id: "add_new_tab", pageid: @obj.id, widgetid: widget.id, href: "#", style: "background-color: #439439; color: white;"}
|
|
13
|
-
New Tab
|
|
14
|
-
|
|
15
|
-
.tab-content
|
|
16
|
-
- widget.tabs.each_with_index do |tab, index|
|
|
17
|
-
- active_class = index == 0 ? 'active' : nil
|
|
18
|
-
-# still toying around with this a bit:
|
|
19
|
-
- if false
|
|
20
|
-
= scrivito_tag(:div, widget, tabs[index], class: "tab-pane fade in #{active_class}", id: tab.id)
|
|
21
|
-
|
|
22
|
-
.tab-pane.fade.in{id: tab.id, class: active_class}
|
|
23
|
-
= scrivito_tag(:div, tab, :content)
|
|
24
|
-
|
|
25
|
-
- if widget.tabs.blank?
|
|
26
|
-
= scrivito_tag(:div, widget, :tabs)
|
|
27
|
-
|