phantom_helpers 0.11.0.alpha4 → 0.11.0.alpha5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phantom_helpers/view_helpers/controller_helper.rb +15 -0
- data/lib/phantom_helpers/view_helpers/count_helper.rb +17 -0
- data/lib/phantom_helpers/view_helpers/extras_helper.rb +32 -0
- data/lib/phantom_helpers/view_helpers/icon_helper.rb +27 -0
- data/lib/phantom_helpers/view_helpers/image_helper.rb +22 -0
- data/lib/phantom_helpers/view_helpers/link_helper.rb +22 -3
- data/lib/phantom_helpers/view_helpers/sort_helper.rb +19 -0
- data/lib/phantom_helpers/view_helpers/table_helper.rb +6 -0
- data/lib/phantom_helpers/view_helpers.rb +14 -2
- data/phantom_helpers.gemspec +1 -1
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caacd7b23e517d9d0c528e93119f7f9f0cdd1649
|
4
|
+
data.tar.gz: b1e08d6e4d5dff2f857c0e9443e98ff8f4c279c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f76c52bb4b012e5e12f4bab65c72ebe418bcfb91328e59101378cdef0ebf2045ae2c44a029ba62bc4322324697bc26d7828637fc32bec9c5e31e0744494202a
|
7
|
+
data.tar.gz: 27b1a8572d51de1f21290bd6aaf468333048fff7a41b35a3e0e4ab71de066b841ed95becc28f169d669a34740dec399ca5eb05c878510d814927ef4b2982d779
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module PhantomHelpers
|
2
|
+
module ViewHelpers
|
3
|
+
module CountHelper
|
4
|
+
|
5
|
+
def count_div(html_class, &block)
|
6
|
+
content_tag :h3, class: "mt-xs #{html_class}" do
|
7
|
+
block.call
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def print_count(count, text)
|
12
|
+
count != 0 ? text + '(' + count.to_s + ')' : text
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module PhantomHelpers
|
2
|
+
module ViewHelpers
|
3
|
+
module ExtrasHelper
|
4
|
+
|
5
|
+
def drag_field
|
6
|
+
content_tag :td, class: 'sort-handler' do
|
7
|
+
content_tag :i, nil, class: 'icon-move'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def required_field
|
12
|
+
content_tag :span, t(:required), class: 'label label-important pull-right'
|
13
|
+
end
|
14
|
+
|
15
|
+
def color_code(color)
|
16
|
+
content_tag :div, nil, style: "width:100px;height:20px;background-color:#{color}"
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def comma_separated_list(objects, &block)
|
21
|
+
if objects.any?
|
22
|
+
objects.map do |object|
|
23
|
+
block_given? ? block.call(object) : object
|
24
|
+
end.join(', ').html_safe
|
25
|
+
else
|
26
|
+
t(:empty)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module PhantomHelpers
|
2
|
+
module ViewHelpers
|
3
|
+
module IconHelper
|
4
|
+
|
5
|
+
def calendar_icon
|
6
|
+
content_tag(:i, nil, class: ' icon-calendar')
|
7
|
+
end
|
8
|
+
|
9
|
+
def download_icon
|
10
|
+
content_tag(:i, nil, class: 'icon-white icon-download')
|
11
|
+
end
|
12
|
+
|
13
|
+
def address_icon
|
14
|
+
content_tag :span, nil, class: 'glyphicon glyphicon-globe'
|
15
|
+
end
|
16
|
+
|
17
|
+
def contact_icon
|
18
|
+
content_tag :span, nil, class: 'glyphicon glyphicon-envelope'
|
19
|
+
end
|
20
|
+
|
21
|
+
def ok_icon
|
22
|
+
content_tag :span, nil, class: 'glyphicon glyphicon-ok'
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module PhantomHelpers
|
2
|
+
module ViewHelpers
|
3
|
+
module ImageHelper
|
4
|
+
|
5
|
+
def boolean_image(field)
|
6
|
+
if field
|
7
|
+
image_tag('tick.png')
|
8
|
+
else
|
9
|
+
image_tag('cross.png')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def resize_image(image_url, options = {})
|
14
|
+
raise 'No size given use :size or :width & :height' unless options[:size] || (options[:height] && options[:width])
|
15
|
+
height = options[:height] || options[:size]
|
16
|
+
width = options[:width] || options[:size]
|
17
|
+
image_tag(image_url, style: "height:#{height}px;width:#{width}px") unless image_url.blank?
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -27,6 +27,14 @@ module PhantomHelpers
|
|
27
27
|
link_to name, resource, attributes
|
28
28
|
end
|
29
29
|
|
30
|
+
def link_to_download(resource, options = {})
|
31
|
+
name = content_tag(:span, nil, class: 'glyphicon glyphicon-download')
|
32
|
+
attributes = {
|
33
|
+
class: "btn btn-xs btn-success download-link"
|
34
|
+
}.merge(options)
|
35
|
+
link_to name, resource, attributes
|
36
|
+
end
|
37
|
+
|
30
38
|
def link_to_upload_image(resource, options = {})
|
31
39
|
name = ("<span class='glyphicon glyphicon-camera'></span> " + t(:'phantom_helpers.picture.change')).html_safe
|
32
40
|
attributes = {:class => "btn btn-default col-xs-12"}.merge(options)
|
@@ -68,11 +76,22 @@ module PhantomHelpers
|
|
68
76
|
link_to name, resource, attributes
|
69
77
|
end
|
70
78
|
|
79
|
+
|
71
80
|
def ajax_link_to_recovery(resource, options = {})
|
72
|
-
name = content_tag(:
|
81
|
+
name = content_tag(:span, nil, class: 'glyphicon glyphicon-repeat')
|
73
82
|
attributes = {
|
74
|
-
:
|
75
|
-
:
|
83
|
+
remote: true,
|
84
|
+
class: "btn btn-xs btn-success recovery-link"
|
85
|
+
}.merge(options)
|
86
|
+
link_to name, resource, attributes
|
87
|
+
end
|
88
|
+
|
89
|
+
def ajax_link_to_restore(resource, options = {})
|
90
|
+
name = content_tag(:span, nil, class: 'glyphicon glyphicon-repeat')
|
91
|
+
attributes = {
|
92
|
+
remote: true,
|
93
|
+
method: :patch,
|
94
|
+
class: "btn btn-xs btn-success recovery-link"
|
76
95
|
}.merge(options)
|
77
96
|
link_to name, resource, attributes
|
78
97
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PhantomHelpers
|
2
|
+
module ViewHelpers
|
3
|
+
module SortHelper
|
4
|
+
|
5
|
+
def sortable(column, title = nil)
|
6
|
+
direction = column == sort_column && sort_direction == 'asc' ? 'desc' : 'asc'
|
7
|
+
css_class = column == sort_column ? "current #{sort_direction}" : nil
|
8
|
+
link_to title, {sort: column, direction: direction}, {class: css_class, remote: true}
|
9
|
+
end
|
10
|
+
|
11
|
+
def student_sortable(column, title = nil)
|
12
|
+
css_class = column == sort_column ? "current #{sort_direction}" : nil
|
13
|
+
direction = column == sort_column && sort_direction == 'asc' ? 'desc' : 'asc'
|
14
|
+
link_to title, params.merge(sort: column, direction: direction, page: nil), {class: css_class}
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,13 +1,25 @@
|
|
1
|
+
require 'phantom_helpers/view_helpers/controller_helper'
|
2
|
+
require 'phantom_helpers/view_helpers/count_helper'
|
3
|
+
require 'phantom_helpers/view_helpers/extras_helper'
|
4
|
+
require 'phantom_helpers/view_helpers/html_helper'
|
5
|
+
require 'phantom_helpers/view_helpers/icon_helper'
|
6
|
+
require 'phantom_helpers/view_helpers/image_helper'
|
1
7
|
require 'phantom_helpers/view_helpers/link_helper'
|
2
8
|
require 'phantom_helpers/view_helpers/modal_helper'
|
9
|
+
require 'phantom_helpers/view_helpers/sort_helper'
|
3
10
|
require 'phantom_helpers/view_helpers/table_helper'
|
4
|
-
require 'phantom_helpers/view_helpers/html_helper'
|
5
11
|
|
6
12
|
module PhantomHelpers
|
7
13
|
module ViewHelpers
|
14
|
+
ActionView::Base.send :include, ControllerHelper
|
15
|
+
ActionView::Base.send :include, CountHelper
|
16
|
+
ActionView::Base.send :include, ExtrasHelper
|
17
|
+
ActionView::Base.send :include, HtmlHelper
|
18
|
+
ActionView::Base.send :include, IconHelper
|
19
|
+
ActionView::Base.send :include, ImageHelper
|
8
20
|
ActionView::Base.send :include, LinkHelper
|
9
21
|
ActionView::Base.send :include, ModalHelper
|
22
|
+
ActionView::Base.send :include, SortHelper
|
10
23
|
ActionView::Base.send :include, TableHelper
|
11
|
-
ActionView::Base.send :include, HtmlHelper
|
12
24
|
end
|
13
25
|
end
|
data/phantom_helpers.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.platform = Gem::Platform::RUBY
|
4
4
|
s.name = 'phantom_helpers'
|
5
|
-
s.version = '0.11.0.
|
5
|
+
s.version = '0.11.0.alpha5'
|
6
6
|
s.summary = 'Phantom View Helpers'
|
7
7
|
s.description = 'rails helpers for bootstrap 3'
|
8
8
|
s.licenses = ['GNU GPL-3', 'AGPL-3']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phantom_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.0.
|
4
|
+
version: 0.11.0.alpha5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vassil Kalkov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-12-09 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: rails helpers for bootstrap 3
|
16
16
|
email: info@genshin.org
|
@@ -24,9 +24,15 @@ files:
|
|
24
24
|
- lib/phantom_helpers.rb
|
25
25
|
- lib/phantom_helpers/railtie.rb
|
26
26
|
- lib/phantom_helpers/view_helpers.rb
|
27
|
+
- lib/phantom_helpers/view_helpers/controller_helper.rb
|
28
|
+
- lib/phantom_helpers/view_helpers/count_helper.rb
|
29
|
+
- lib/phantom_helpers/view_helpers/extras_helper.rb
|
27
30
|
- lib/phantom_helpers/view_helpers/html_helper.rb
|
31
|
+
- lib/phantom_helpers/view_helpers/icon_helper.rb
|
32
|
+
- lib/phantom_helpers/view_helpers/image_helper.rb
|
28
33
|
- lib/phantom_helpers/view_helpers/link_helper.rb
|
29
34
|
- lib/phantom_helpers/view_helpers/modal_helper.rb
|
35
|
+
- lib/phantom_helpers/view_helpers/sort_helper.rb
|
30
36
|
- lib/phantom_helpers/view_helpers/table_helper.rb
|
31
37
|
- locales/en.yml
|
32
38
|
- locales/ja.yml
|
@@ -55,8 +61,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
61
|
requirements:
|
56
62
|
- none
|
57
63
|
rubyforge_project:
|
58
|
-
rubygems_version: 2.
|
64
|
+
rubygems_version: 2.1.11
|
59
65
|
signing_key:
|
60
66
|
specification_version: 4
|
61
67
|
summary: Phantom View Helpers
|
62
68
|
test_files: []
|
69
|
+
has_rdoc:
|