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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a55091da56be66ea922314f34c1034e4bb48fd4
4
- data.tar.gz: 1bd913434d298b6e01d584a0927812b7b00ca681
3
+ metadata.gz: eef0aedc7a2ffe5c6d3486047ecd3bd1ea69dc21
4
+ data.tar.gz: 8b7ad66c776d1b7e21a03deb9ceb79a1b19eb82c
5
5
  SHA512:
6
- metadata.gz: 68f1764033f173bb098a2665809d7dfd4c77d7bde7c6995d5e7879eef88cc4c39667a59f19c57260bcf91f3f469722724bdab061e821b7c423f26847ebba801c
7
- data.tar.gz: 868529d148a174dfc341393b1b67b3a3c56357346c240d7567d05a20fb976c03314430b3db8ca673608d701728ee17c0cd85d3cb8c4ad84cea93713712a695b6
6
+ metadata.gz: c8f9f0cc775fb181e99605c73ea6ab5219706355eee43c7a69b8f9ec1cb44bb92d36cdc7688fb2ce0b0297f3a00792b7e99932ccf80758f8dd27a715d9b659d0
7
+ data.tar.gz: d9374c4e4bf2a950bf6e3ee6ce80235ed0fe6692b03d2a9412f45833f74de272341e3a18eb13c08202a2be48d700597277b0c73bc3464fd60ce211eeca985003
@@ -1,4 +1,3 @@
1
1
  /*
2
- *= require font-awesome
3
2
  *= require_tree ./scrivito_icon_box_widget
4
3
  */
@@ -27,7 +27,7 @@
27
27
  width: 81px;
28
28
  height: 51px;
29
29
  text-align: center;
30
- .fa {
30
+ > i {
31
31
  font-size: 20px;
32
32
  display: block;
33
33
  margin-bottom: 4px;
@@ -1,10 +1,14 @@
1
1
  class IconBoxWidget < Widget
2
- attribute :icon, :string, default: 'leaf'
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
- ["none", "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
+ 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='fa fa-#{elem}'></i>#{elem}".html_safe
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 = ["fa"]
38
- c << "fa-#{self.icon}"
41
+ c = []
42
+ c << "#{IconBoxWidget.icon_set}-#{self.icon}"
39
43
  c << self.color
40
44
  c.join(' ')
41
45
  end
42
- end
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 list does not contain an icon for your need, look at <a href="https://fortawesome.github.io/Font-Awesome/icons/" target="_blank">fontawesome webpage</a>. There are more then 500 icons that ca be used. Write the name of the icon with out fa- in the field. For Exeample: <stong>car</stong> instead of <i>fa-car</i>.
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 ScrivitoIconBox
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
@@ -1,5 +1,3 @@
1
- require 'font-awesome-rails'
2
-
3
1
  module ScrivitoIconBoxWidget
4
2
  class Engine < ::Rails::Engine
5
3
  isolate_namespace ScrivitoIconBoxWidget
@@ -1,3 +1,3 @@
1
1
  module ScrivitoIconBoxWidget
2
- VERSION = "1.2.5"
2
+ VERSION = "2.0.0"
3
3
  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: 1.2.5
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-09-20 00:00:00.000000000 Z
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