scrivito_icon_box_widget 1.2.5 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/scrivito_icon_box_widget.css +0 -1
- data/app/assets/stylesheets/scrivito_icon_box_widget/base.css.scss +1 -1
- data/app/models/icon_box_widget.rb +15 -6
- data/app/views/icon_box_widget/partials/_icons_picker.html.erb +1 -1
- data/lib/scrivito_icon_box_widget.rb +17 -1
- data/lib/scrivito_icon_box_widget/configuration.rb +15 -0
- data/lib/scrivito_icon_box_widget/engine.rb +0 -2
- data/lib/scrivito_icon_box_widget/version.rb +1 -1
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eef0aedc7a2ffe5c6d3486047ecd3bd1ea69dc21
|
4
|
+
data.tar.gz: 8b7ad66c776d1b7e21a03deb9ceb79a1b19eb82c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8f9f0cc775fb181e99605c73ea6ab5219706355eee43c7a69b8f9ec1cb44bb92d36cdc7688fb2ce0b0297f3a00792b7e99932ccf80758f8dd27a715d9b659d0
|
7
|
+
data.tar.gz: d9374c4e4bf2a950bf6e3ee6ce80235ed0fe6692b03d2a9412f45833f74de272341e3a18eb13c08202a2be48d700597277b0c73bc3464fd60ce211eeca985003
|
@@ -1,10 +1,14 @@
|
|
1
1
|
class IconBoxWidget < Widget
|
2
|
-
attribute :icon, :string
|
2
|
+
attribute :icon, :string
|
3
3
|
attribute :color, :string
|
4
4
|
attribute :background_color, :string
|
5
5
|
attribute :size, :enum, values: ["small","medium","large"], default: 'large'
|
6
6
|
attribute :style, :enum, values: ["circle","square","filled-circle","filled-square"], default: 'circle'
|
7
7
|
|
8
|
+
default_for :icon do |a,b|
|
9
|
+
ScrivitoIconBoxWidget.configuration.default
|
10
|
+
end
|
11
|
+
|
8
12
|
def selectable_color_classes(class_name, attribute)
|
9
13
|
if Obj.respond_to?('selectable_color_classes')
|
10
14
|
Obj.selectable_color_classes(class_name, attribute)
|
@@ -14,13 +18,13 @@ class IconBoxWidget < Widget
|
|
14
18
|
end
|
15
19
|
|
16
20
|
def self.icons
|
17
|
-
|
21
|
+
ScrivitoIconBoxWidget.configuration.selection
|
18
22
|
end
|
19
23
|
|
20
24
|
def self.caption
|
21
25
|
elems = {}
|
22
26
|
IconBoxWidget.icons.each do |elem|
|
23
|
-
elems[elem] = "<i class='
|
27
|
+
elems[elem] = "<i class='#{IconBoxWidget.icon_set}-#{elem}'></i>#{elem}".html_safe
|
24
28
|
end
|
25
29
|
return elems
|
26
30
|
end
|
@@ -34,9 +38,14 @@ class IconBoxWidget < Widget
|
|
34
38
|
end
|
35
39
|
|
36
40
|
def icon_classes
|
37
|
-
c = [
|
38
|
-
c << "
|
41
|
+
c = []
|
42
|
+
c << "#{IconBoxWidget.icon_set}-#{self.icon}"
|
39
43
|
c << self.color
|
40
44
|
c.join(' ')
|
41
45
|
end
|
42
|
-
|
46
|
+
|
47
|
+
private
|
48
|
+
def self.icon_set
|
49
|
+
ScrivitoIconBoxWidget.configuration.set
|
50
|
+
end
|
51
|
+
end
|
@@ -4,6 +4,6 @@
|
|
4
4
|
<hr />
|
5
5
|
<h4>Icon not in List</h4>
|
6
6
|
<div class="alert alert-info">
|
7
|
-
If the
|
7
|
+
If the icon does not apear in the list, look at <a href="<%= ScrivitoIconBoxWidget.configuration.all_icons_link %>" target="_blank"><%= ScrivitoIconBoxWidget.configuration.all_icons_link %></a> to find more.
|
8
8
|
</div>
|
9
9
|
<%= scrivito_tag :div, widget, :icon %>
|
@@ -1,4 +1,20 @@
|
|
1
1
|
require "scrivito_icon_box_widget/engine"
|
2
|
+
require "scrivito_icon_box_widget/configuration"
|
2
3
|
|
3
|
-
module
|
4
|
+
module ScrivitoIconBoxWidget
|
5
|
+
class << self
|
6
|
+
attr_writer :configuration
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.configuration
|
10
|
+
@configuration ||= Configuration.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.reset
|
14
|
+
@configuration = Configuration.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.configure
|
18
|
+
yield(configuration)
|
19
|
+
end
|
4
20
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ScrivitoIconBoxWidget
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :set
|
4
|
+
attr_accessor :selection
|
5
|
+
attr_accessor :default
|
6
|
+
attr_accessor :all_icons_link
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@set = 'glyphicon glyphicon'
|
10
|
+
@selection = ['none', 'plus', 'minus', 'cloud', 'envelope', 'pencil', 'search', 'star', 'user', 'cog', 'home', 'tag', 'book', 'bookmark', 'map-marker', 'leaf', 'fire', 'eye-open', 'plane', 'thumbs-up', 'globe', 'briefcase', 'send', 'tower', 'apple', 'ice-lolly', 'grain', 'scale']
|
11
|
+
@default = 'ice-lolly'
|
12
|
+
@all_icons_link = 'https://getbootstrap.com/components/#glyphicons'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrivito_icon_box_widget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.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: 2016-
|
11
|
+
date: 2016-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: scrivito_sdk
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: font-awesome-rails
|
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
27
|
description: Widget for scrivito to display an icon in a box.
|
42
28
|
email:
|
43
29
|
- support@scrivito.com
|
@@ -58,6 +44,7 @@ files:
|
|
58
44
|
- app/views/icon_box_widget/show.html.erb
|
59
45
|
- app/views/icon_box_widget/thumbnail.html.erb
|
60
46
|
- lib/scrivito_icon_box_widget.rb
|
47
|
+
- lib/scrivito_icon_box_widget/configuration.rb
|
61
48
|
- lib/scrivito_icon_box_widget/engine.rb
|
62
49
|
- lib/scrivito_icon_box_widget/version.rb
|
63
50
|
- lib/tasks/scrivito_icon_box_widget_tasks.rake
|