scrivito_icon_box_widget 1.0.1
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/Rakefile +21 -0
- data/app/assets/javascript/icon_box_widget/editing/editors/button_picker.js +32 -0
- data/app/assets/javascript/icon_box_widget/editing.js +2 -0
- data/app/assets/stylesheets/icon_box_widget/application.css +4 -0
- data/app/assets/stylesheets/icon_box_widget/editing.css +19 -0
- data/app/assets/stylesheets/icon_box_widget/widget.css +54 -0
- data/app/models/icon_box_widget.rb +35 -0
- data/app/views/icon_box_widget/details.html.erb +23 -0
- data/app/views/icon_box_widget/partials/_color_picker.html.erb +5 -0
- data/app/views/icon_box_widget/partials/_icon_picker.html.erb +10 -0
- data/app/views/icon_box_widget/partials/_size_picker.html.erb +5 -0
- data/app/views/icon_box_widget/partials/_style_picker.html.erb +5 -0
- data/app/views/icon_box_widget/show.html.erb +3 -0
- data/app/views/icon_box_widget/thumbnail.html.erb +13 -0
- data/cms/migrate/0_create_icon_box_widget.rb +17 -0
- data/lib/generators/scrivito_icon_box_widget.rb +7 -0
- data/lib/generators/scrivito_icon_box_widget_generator.rb +7 -0
- data/lib/scrivito_icon_box_widget/engine.rb +5 -0
- data/lib/scrivito_icon_box_widget/version.rb +3 -0
- data/lib/scrivito_icon_box_widget.rb +4 -0
- data/lib/tasks/scrivito_icon_box_widget_tasks.rake +4 -0
- metadata +122 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 049bfd93b63a5e8369b97a0085dab51f0ea93067
|
4
|
+
data.tar.gz: fe0f3318d69cecb66301d51b4b22c22776522b13
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 228b64fe67c1f52f51bf7940e10a1a17a18c399b5cdcfb6f73d47e1479f711e49d5e0d4de4081e8af2fb24d69f7a0f18738280801c6070267ecdad8d066016c1
|
7
|
+
data.tar.gz: e12062cb0bcf57f56c1c7f27c720ae91bb14386d396a449c1f39b57bea55b273bd3ca1fc472d939eaba418a68087a12d317b309fe6110a52e646aad9b4e185e7
|
data/LICENSE
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
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 = 'ScrivitoIconBoxWidget'
|
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
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
(function($, App) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
$(function() {
|
5
|
+
|
6
|
+
App.buttonPickerEditor = {
|
7
|
+
// set selector for Editor
|
8
|
+
selector: '.button-picker',
|
9
|
+
|
10
|
+
// Function that will be called on scrvito load
|
11
|
+
initFunction: function(index, elem) {},
|
12
|
+
|
13
|
+
// set function triggert on click
|
14
|
+
clickFunction: function(cmsField) {
|
15
|
+
var text = cmsField.data('picker-content');
|
16
|
+
|
17
|
+
cmsField.addClass('activated');
|
18
|
+
cmsField.siblings().removeClass('activated');
|
19
|
+
|
20
|
+
return cmsField.scrivito('save', text);
|
21
|
+
},
|
22
|
+
};
|
23
|
+
|
24
|
+
// Set click event
|
25
|
+
scrivito.on('load', function() {
|
26
|
+
return $('body').on('click', buttonPickerEditor.selector, function(event) {
|
27
|
+
buttonPickerEditor.clickFunction($(event.target));
|
28
|
+
});
|
29
|
+
});
|
30
|
+
});
|
31
|
+
|
32
|
+
})(jQuery, this);
|
@@ -0,0 +1,19 @@
|
|
1
|
+
.scrivito_button.button-picker {
|
2
|
+
margin: 0 0 4px 0;
|
3
|
+
height: auto !important;
|
4
|
+
width: 120px !important;
|
5
|
+
text-align: left;
|
6
|
+
text-shadow: 0 0 2px #222;
|
7
|
+
background: #444;
|
8
|
+
color: #fff;
|
9
|
+
outline: none !important;
|
10
|
+
border: none;
|
11
|
+
}
|
12
|
+
|
13
|
+
.scrivito_button.button-picker:hover {
|
14
|
+
background: #888;
|
15
|
+
}
|
16
|
+
|
17
|
+
.scrivito_button.button-picker.activated {
|
18
|
+
box-shadow: 0 0 0 1px rgba(255,255,255,0.6) inset, 0 0 3px 1px #222
|
19
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
.scrivito-icon-box {
|
2
|
+
overflow: hidden;
|
3
|
+
margin: 10px auto;
|
4
|
+
padding: 10px;
|
5
|
+
box-sizing: initial;
|
6
|
+
-webkit-box-sizing: initial;
|
7
|
+
-moz-box-sizing: initial;
|
8
|
+
}
|
9
|
+
|
10
|
+
.scrivito-icon-box.circle,
|
11
|
+
.scrivito-icon-box.filled-circle {
|
12
|
+
border-radius: 50px;
|
13
|
+
text-align: center;
|
14
|
+
}
|
15
|
+
|
16
|
+
.scrivito-icon-box.small {
|
17
|
+
width: 50px;
|
18
|
+
height: 50px;
|
19
|
+
}
|
20
|
+
|
21
|
+
.scrivito-icon-box.medium {
|
22
|
+
width: 60px;
|
23
|
+
height: 60px;
|
24
|
+
}
|
25
|
+
|
26
|
+
.scrivito-icon-box.large {
|
27
|
+
width: 70px;
|
28
|
+
height: 70px;
|
29
|
+
}
|
30
|
+
|
31
|
+
.scrivito-icon-box i {
|
32
|
+
margin: 10px;
|
33
|
+
}
|
34
|
+
|
35
|
+
.scrivito-icon-box.small i {
|
36
|
+
font-size: 30px;
|
37
|
+
height: 30px;
|
38
|
+
width: 30px;
|
39
|
+
line-height: 30px;
|
40
|
+
}
|
41
|
+
|
42
|
+
.scrivito-icon-box.medium i {
|
43
|
+
font-size: 40px;
|
44
|
+
height: 40px;
|
45
|
+
width: 40px;
|
46
|
+
line-height: 40px;
|
47
|
+
}
|
48
|
+
|
49
|
+
.scrivito-icon-box.large i {
|
50
|
+
font-size: 50px;
|
51
|
+
height: 50px;
|
52
|
+
width: 50px;
|
53
|
+
line-height: 50px;
|
54
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class IconBoxWidget < Widget
|
2
|
+
|
3
|
+
def self.colors
|
4
|
+
if Rails.configuration.respond_to?(:icon_box_colors)
|
5
|
+
Rails.configuration.icon_box_colors.split(" ")
|
6
|
+
else
|
7
|
+
IconBoxWidget.fallback_colors.split(" ")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.sizes
|
12
|
+
["small","medium","large"]
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.styles
|
16
|
+
["circle","square","filled-circle","filled-square"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.icons
|
20
|
+
["plus","minus","warning","paw","send","car","sliders","tree","bell","certificate","cloud","comment","dashboard","female","male","flag","globe","heart","leaf","plane","refresh","rocket","question","star","unlock"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def background_style
|
24
|
+
if self.style && self.style.start_with?('filled')
|
25
|
+
"background-color: #{self.background_color}"
|
26
|
+
elsif self.style
|
27
|
+
"border: 3px solid #{self.background_color}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def self.fallback_colors
|
33
|
+
"transparent #000000 #585858 #d9d9d9 #FFFFFF #003380 #6699CC #CC0000"
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<h4>Icon</h4>
|
2
|
+
<div class="alert alert-info">
|
3
|
+
<p>More Icons can be found at
|
4
|
+
<a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank"><strong>Font Awesome</strong></a>.
|
5
|
+
</p>
|
6
|
+
<p>
|
7
|
+
Use only the name of the icon without fa. For Example the icon <i>fa fa-car</i>, use only <strong>car</strong>
|
8
|
+
</p>
|
9
|
+
|
10
|
+
</div>
|
11
|
+
<%= render "icon_box_widget/partials/icon_picker", widget: widget, attribute: :icon %>
|
12
|
+
|
13
|
+
<h4>Size</h4>
|
14
|
+
<%= render "icon_box_widget/partials/size_picker", widget: widget, attribute: :size %>
|
15
|
+
|
16
|
+
<h4>Style</h4>
|
17
|
+
<%= render "icon_box_widget/partials/style_picker", widget: widget, attribute: :style %>
|
18
|
+
|
19
|
+
<h4>Color</h4>
|
20
|
+
<%= render "icon_box_widget/partials/color_picker", widget: widget, attribute: :color %>
|
21
|
+
|
22
|
+
<h4>Background Color</h4>
|
23
|
+
<%= render "icon_box_widget/partials/color_picker", widget: widget, attribute: :background_color %>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<div class="button-picker-wraper">
|
2
|
+
<% IconBoxWidget.colors.each do |color| %>
|
3
|
+
<%= scrivito_tag(:button, widget, attribute, class: "scrivito_button button-picker #{widget.send(attribute) == color ? "activated" : ""}", style: "background: #{color}", :"data-picker-content" => color, :"data-editor" => 'button-picker') do %><%= color %><% end %>
|
4
|
+
<% end %>
|
5
|
+
</div>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% IconBoxWidget.icons.each do |icon| %>
|
2
|
+
<%= scrivito_tag(:button, widget, attribute,
|
3
|
+
class: "scrivito_button button-picker #{widget.send(attribute) == icon ? "activated" : ""}",
|
4
|
+
:"data-picker-content" => icon, :"data-editor" => 'button-picker') do %>
|
5
|
+
<i class="fa fa-<%= icon %>"></i> <%= icon %>
|
6
|
+
<% end %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<h4>Different Icon</h4>
|
10
|
+
<%= scrivito_tag(:div, widget, attribute) %>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<% IconBoxWidget.sizes.each do |size| %>
|
2
|
+
<%= scrivito_tag(:button, widget, attribute, class: "scrivito_button button-picker #{widget.send(attribute) == size ? "activated" : ""}", :"data-picker-content" => size, :"data-editor" => 'button-picker') do %>
|
3
|
+
<%= size %>
|
4
|
+
<% end %>
|
5
|
+
<% end %>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<% IconBoxWidget.styles.each do |style| %>
|
2
|
+
<%= scrivito_tag(:button, widget, attribute, class: "scrivito_button button-picker #{widget.send(attribute) == style ? "activated" : ""}", :"data-picker-content" => style, :"data-editor" => 'button-picker') do %>
|
3
|
+
<%= style %>
|
4
|
+
<% end %>
|
5
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div class="editing-dialog-thumbnail">
|
2
|
+
<div class="visualization">
|
3
|
+
<span class="icon editing-icon-image"></span>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<div class="title">
|
7
|
+
Icon Box
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="description">
|
11
|
+
A Box to display an icon in specified color and shape.
|
12
|
+
</div>
|
13
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateIconBoxWidget < ::Scrivito::Migration
|
2
|
+
def up
|
3
|
+
Scrivito::ObjClass.create(
|
4
|
+
name: 'IconBoxWidget',
|
5
|
+
type: 'publication',
|
6
|
+
is_binary: false,
|
7
|
+
title: 'Icon Box Widget',
|
8
|
+
attributes: [
|
9
|
+
{:name=>"icon", :type=>"string"},
|
10
|
+
{:name=>"color", :type=>"string"},
|
11
|
+
{:name=>"background_color", :type=>"string"},
|
12
|
+
{:name=>"size", :type=>"enum", :values=>["small","medium","large"]},
|
13
|
+
{:name=>"style", :type=>"enum", :values=>["circle","square","filled-circle","filled-square"]},
|
14
|
+
]
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# config/initializers/load_config.rb
|
2
|
+
APP_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")
|
3
|
+
|
4
|
+
# application.rb
|
5
|
+
if APP_CONFIG && APP_CONFIG['scrivito_icon_box_widget']['colors']
|
6
|
+
Rails.configuration.icon_box_colors = APP_CONFIG['scrivito_icon_box_widget']['colors']
|
7
|
+
end
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: scrivito_icon_box_widget
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Scrivito
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
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
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: scrivito_sdk
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: font-awesome-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Widget for scrivito to display an icon in a box.
|
70
|
+
email:
|
71
|
+
- support@scrivito.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- LICENSE
|
77
|
+
- Rakefile
|
78
|
+
- app/assets/javascript/icon_box_widget/editing.js
|
79
|
+
- app/assets/javascript/icon_box_widget/editing/editors/button_picker.js
|
80
|
+
- app/assets/stylesheets/icon_box_widget/application.css
|
81
|
+
- app/assets/stylesheets/icon_box_widget/editing.css
|
82
|
+
- app/assets/stylesheets/icon_box_widget/widget.css
|
83
|
+
- app/models/icon_box_widget.rb
|
84
|
+
- app/views/icon_box_widget/details.html.erb
|
85
|
+
- app/views/icon_box_widget/partials/_color_picker.html.erb
|
86
|
+
- app/views/icon_box_widget/partials/_icon_picker.html.erb
|
87
|
+
- app/views/icon_box_widget/partials/_size_picker.html.erb
|
88
|
+
- app/views/icon_box_widget/partials/_style_picker.html.erb
|
89
|
+
- app/views/icon_box_widget/show.html.erb
|
90
|
+
- app/views/icon_box_widget/thumbnail.html.erb
|
91
|
+
- cms/migrate/0_create_icon_box_widget.rb
|
92
|
+
- lib/generators/scrivito_icon_box_widget.rb
|
93
|
+
- lib/generators/scrivito_icon_box_widget_generator.rb
|
94
|
+
- lib/scrivito_icon_box_widget.rb
|
95
|
+
- lib/scrivito_icon_box_widget/engine.rb
|
96
|
+
- lib/scrivito_icon_box_widget/version.rb
|
97
|
+
- lib/tasks/scrivito_icon_box_widget_tasks.rake
|
98
|
+
homepage: https://www.scrivito.com
|
99
|
+
licenses:
|
100
|
+
- LGPL-3.0
|
101
|
+
metadata: {}
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
requirements: []
|
117
|
+
rubyforge_project:
|
118
|
+
rubygems_version: 2.3.0
|
119
|
+
signing_key:
|
120
|
+
specification_version: 4
|
121
|
+
summary: Widget for scrivito to display an icon in a box.
|
122
|
+
test_files: []
|