scrivito_accordion_widget 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9df3a5713ded233e49006e054850b0db0117265a
4
- data.tar.gz: b7d5c14d4fbdfd96fd4f539ab33790b1a7b45e54
3
+ metadata.gz: 1dca34b6bf305573c5e0a3c60a7e49a6e595df31
4
+ data.tar.gz: 05bf5f62784514f1b524738eb1a9b68b60fbd9dc
5
5
  SHA512:
6
- metadata.gz: f5968ba71d3c93339326247928b44d00bbe62a7b35c32beb2304e918c2be6e98e58f88338d6b48b2ab6acd3345f24f8ea6066b79964a2fbdc7ea58010d724aa3
7
- data.tar.gz: c9f50c0a7bb98a3a4370fa502ed35c8b1634e7656ae6de9238e52745c6f5019caba6224728e53ba98b07308967f388f7427842e4ed331ba1d5048b1b5734aefe
6
+ metadata.gz: 4c8750ea96514bb26a529af8c6f89e7ef3921a6f94a7e4f63aa32aff91ebcfe36385b20585d65a27810915a21f79903f8431a9865ee56890eead9413f5cb4f79
7
+ data.tar.gz: e56e0ef6aec00165b44bbae3000e1db262f0743e9fd730e8bae15ae0199082a3d9455cfaa9b6e22238bc55375dcb6d012080f4e383ac25d7450b738f56391acd
data/README.md CHANGED
@@ -1,13 +1,10 @@
1
1
  # scrivito_accordion_widget
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/scrivito_accordion_widget.svg)](http://badge.fury.io/rb/scrivito_accordion_widget)
4
- [![Code Climate](https://codeclimate.com/github/Scrivito/scrivito_accordion_widget/badges/gpa.svg)](https://codeclimate.com/github/Scrivito/scrivito_accordion_widget)
5
4
 
6
5
  ## Installation
7
6
 
8
- A Widget for Scrivito for an accordion. It is using Bootstrap 3.
9
-
10
- If they use a different framework, then they should overwrite the views and the javascript.
7
+ A Widget for Scrivito for an accordion.
11
8
 
12
9
  ## Installation
13
10
 
@@ -19,12 +16,9 @@ Than add to your stylesheet manifest:
19
16
 
20
17
  *= require scrivito_accordion_widget
21
18
 
22
- After that, execute:
19
+ Than add to your Javascript manifest:
23
20
 
24
- $ bundle
25
- $ rake scrivito:migrate:install
26
- $ rake scrivito:migrate
27
- $ rake scrivito:migrate:publish
21
+ *//= require scrivito_accordion_widget
28
22
 
29
23
  ## Changelog
30
24
  See [Changelog](https://github.com/Scrivito/scrivito_accordion_widget/blob/master/CHANGELOG.md) for more
@@ -1,11 +1,20 @@
1
- $(function() {
2
- $.each($("[data-scrivito-widget-obj-class='AccordionWidget']"), function(index, accordion) {
3
- $(accordion).scrivito("menu").add("add_panel_to_accordion", {
4
- title: "Add Panel",
5
- icon: "plus",
6
- execute: function(dom_element) {
7
- // TODO: create new widget
8
- },
1
+ (function($, App) {
2
+ 'use strict';
3
+
4
+ $(function() {
5
+ scrivito.on('content', function(content) {
6
+ $(content).find('.scrivito-accordion-group').each(function(i, group) {
7
+ var accordion_group = $(group);
8
+ accordion_group.find('.scrivito-accordion-title').each(function(i, accordion_title) {
9
+ var accordion_title = $(accordion_title);
10
+ accordion_title.click(function() {
11
+ accordion_group.find('.scrivito-accordion-title').removeClass('scrivito-accordion-active');
12
+ accordion_title.addClass('scrivito-accordion-active');
13
+ accordion_group.find('.scrivito-accordion-content').removeClass('scrivito-accordion-active');
14
+ accordion_title.next().addClass('scrivito-accordion-active');
15
+ });
16
+ });
17
+ });
9
18
  });
10
19
  });
11
- });
20
+ })(jQuery, this);
@@ -0,0 +1,18 @@
1
+ .scrivito-accordion-group {
2
+ .scrivito-accordion-title {
3
+ background-color: #fff;
4
+ padding: 10px;
5
+ font-size: 14px;
6
+ line-height: 14px;
7
+ cursor: pointer;
8
+ &.scrivito-accordion-active {
9
+ background-color: #ddd;
10
+ }
11
+ }
12
+ .scrivito-accordion-content {
13
+ display: none;
14
+ }
15
+ .scrivito-accordion-content.scrivito-accordion-active {
16
+ display: block;
17
+ }
18
+ }
@@ -1,13 +1,14 @@
1
1
  class AccordionPanelWidget < Widget
2
- attribute :headline, :string
2
+ attribute :title, :string, default: 'New Panel'
3
3
  attribute :content, :widgetlist
4
4
 
5
- def active_class
6
- "in" if self.container.panels.first == self
7
- end
5
+ attribute :background_color, :string
8
6
 
9
- def description_for_editor
10
- "Accordion Panel"
7
+ def self.valid_container_classes
8
+ [AccordionWidget]
11
9
  end
12
10
 
13
- end
11
+ def self.description_for_editor
12
+ 'Panel'
13
+ end
14
+ end
@@ -1,12 +1,14 @@
1
1
  class AccordionWidget < Widget
2
- attribute :panels, :widgetlist
3
-
4
- def description_for_editor
5
- "Accordion"
6
- end
2
+ attribute :panels, :widgetlist, default: [
3
+ AccordionPanelWidget.new(title: 'First Panel'),
4
+ AccordionPanelWidget.new(title: 'Second Panel')
5
+ ]
7
6
 
8
7
  def valid_widget_classes_for(field_name)
9
- %w[AccordionPanelWidget]
8
+ [AccordionPanelWidget]
10
9
  end
11
10
 
11
+ def self.description_for_editor
12
+ 'Accordion'
13
+ end
12
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,3 @@
1
+ <%= scrivito_details_for do %>
2
+ <%= scrivito_tag :div, widget, :panels, 'data-scrivito-modal-size' => 'large' %>
3
+ <% end %>
@@ -1,12 +1,8 @@
1
- <div class='panel-group' id='<%= "accordion-#{widget.id}" %>' role="tablist" aria-multiselectable="true">
2
-
3
- <% widget.panels.each do |panel| %>
4
- <%= render 'accordion_panel_widget/show', widget: panel %>
1
+ <div class="scrivito-accordion-group">
2
+ <% widget.panels.each_with_index do |panel, i| %>
3
+ <div class="scrivito-accordion-title <%= 'scrivito-accordion-active' if i == 0 %>">
4
+ <%= scrivito_value panel.title %>
5
+ </div>
6
+ <%= scrivito_tag :div, panel, :content, class: "scrivito-accordion-content #{'scrivito-accordion-active' if i == 0}" %>
5
7
  <% end %>
6
-
7
8
  </div>
8
-
9
-
10
-
11
-
12
- <%#= scrivito_tag(:div, widget, :panels, class: 'panel-group', id: "accordion-#{widget.id}", role: "tablist") %>
@@ -1,3 +1,3 @@
1
1
  module ScrivitoAccordionWidget
2
- VERSION = "1.0.8"
2
+ VERSION = "1.0.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivito_accordion_widget
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scrivito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-21 00:00:00.000000000 Z
11
+ date: 2015-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -64,11 +64,11 @@ files:
64
64
  - Rakefile
65
65
  - app/assets/images/widget_preview_accordion.png
66
66
  - app/assets/javascripts/scrivito_accordion_widget.js
67
- - app/assets/stylesheets/scrivito_accordion_widget.css
67
+ - app/assets/stylesheets/scrivito_accordion_widget.css.scss
68
68
  - app/models/accordion_panel_widget.rb
69
69
  - app/models/accordion_widget.rb
70
- - app/views/accordion_panel_widget/_show.html.erb
71
- - app/views/accordion_panel_widget/thumbnail.html.erb
70
+ - app/views/accordion_panel_widget/details.html.erb
71
+ - app/views/accordion_widget/details.html.erb
72
72
  - app/views/accordion_widget/show.html.erb
73
73
  - app/views/accordion_widget/thumbnail.html.erb
74
74
  - lib/scrivito_accordion_widget.rb
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  requirements: []
98
98
  rubyforge_project:
99
- rubygems_version: 2.2.2
99
+ rubygems_version: 2.4.5
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: Scrivito Accordion Widget.
@@ -1,11 +0,0 @@
1
- .scrivito_editing_active .panel-group .panel-body.scrivito_empty_widget_field {
2
- margin: 10px !important;
3
- }
4
-
5
- .scrivito_editing_active .panel-group .panel-body {
6
- margin: 0px !important;
7
- }
8
-
9
- .scrivito_editing_active .panel-group {
10
- padding-top: 30px;
11
- }
@@ -1,11 +0,0 @@
1
- <div class="panel panel-default">
2
- <div class="panel-heading">
3
- <h4 class="panel-title">
4
- <%= scrivito_tag(:a, widget, :headline, href: "#collapse-panel-#{widget.id}", data: { toggle: 'collapse', parent: "#accordion-#{widget.container.id}" }) %>
5
- </h4>
6
- </div>
7
-
8
- <div class="panel-collapse collapse <%= widget.active_class %>" id="collapse-panel-<%= widget.id %>">
9
- <%= scrivito_tag(:div, widget, :content, class: 'panel-body') %>
10
- </div>
11
- </div>
@@ -1,3 +0,0 @@
1
- <%= scrivito_thumbnail 'Accordion Panel', image_tag("widget_preview_accordion.png") do %>
2
- Displays a collapsible content panel inside an accordion widget.
3
- <% end %>