phantom_helpers 0.10.0 → 0.11.0.alpha1

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: 2ca4571eb652fe5070050295013e55a9cf9b5d04
4
- data.tar.gz: 7a125f3bf7c3913e25fd7d3bb8ce725182b8c63c
3
+ metadata.gz: 17d99fbe1b64e71f6803eb72b35f509b2e578321
4
+ data.tar.gz: 43f44d919fc5ac785d01b3b01d606c16bbba6f48
5
5
  SHA512:
6
- metadata.gz: 38cabb862d47ea6d8dc6c438f0d194689f959cae2c9e2d95150ce6f1d37ceb88c77d15e22552fc81c39b59aaa464eb06bf91dc6f250b3de7060026d0668332c2
7
- data.tar.gz: 14f392824a2bac600e8186a5350a604457aba825438a5d7b6b0357f3d45081d0da4ebda10345939c14da762e1b1d6e75158ac01b9f0ff3e9aa30ba530f541977
6
+ metadata.gz: c27d1b10c137fc8a44aa7e1d2dfeb328576e4a0cfcbf3459994a8a85b293624d91648761827b0235912547b9b183a0430284bc95672b374a022e309bcdf2e4ed
7
+ data.tar.gz: 56d4381f08e09289d3d6105b5228549ea083ba122813665d28c2e4ea0c09b8abc1822005c50fde432e54a96d9aa7b157edb533f2f29eb9d2c3e0b9ac3929a734
@@ -24,7 +24,7 @@ module PhantomHelpers
24
24
  content_tag :div, class: "row" do
25
25
  content_tag :div, class: "col-md-12" do
26
26
  content_tag :div, class: "panel panel-#{color}" do
27
-
27
+
28
28
  case type
29
29
  when "default"
30
30
  [
@@ -72,7 +72,7 @@ module PhantomHelpers
72
72
  end
73
73
  end
74
74
  end
75
-
75
+
76
76
  def index_body(&block)
77
77
  content_tag :div, class: "row" do
78
78
  content_tag :div, class: "col-md-12" do
@@ -82,13 +82,17 @@ module PhantomHelpers
82
82
  end
83
83
 
84
84
  def index_header(&block)
85
- content_tag :div, class: "row" do
85
+ content_tag :div, class: "row index-header" do
86
86
  content_tag :div, class: "col-md-12" do
87
87
  block.call
88
88
  end
89
89
  end
90
90
  end
91
91
 
92
+ def footer(&block)
93
+ content_tag(:div, class: "row mt-l") { block.call }
94
+ end
95
+
92
96
  end
93
97
  end
94
98
  end
@@ -92,6 +92,25 @@ module PhantomHelpers
92
92
  link_to name, resource, attributes
93
93
  end
94
94
 
95
+ def link_to_delete_with_text(resource, options = {})
96
+ attributes = {
97
+ :method => :delete,
98
+ :data => {confirm: t(:'phantom_helpers.confirm_delete')},
99
+ :class => 'btn btn-danger'
100
+ }.merge(options)
101
+ link_to t(:'phantom_helpers.delete'), resource, attributes
102
+ end
103
+
104
+
105
+ def link_to_soft_delete_with_text(resource, options = {})
106
+ attributes = {
107
+ :method => :patch,
108
+ :data => {confirm: t(:'phantom_helpers.confirm_delete')},
109
+ :class => 'btn btn-danger'
110
+ }.merge(options)
111
+ link_to t(:'phantom_helpers.delete'), resource, attributes
112
+ end
113
+
95
114
  def ajax_link_to_delete(resource, options = {})
96
115
  name = ("<span class='glyphicon glyphicon-remove'></span>").html_safe
97
116
  attributes = {
@@ -103,12 +122,13 @@ module PhantomHelpers
103
122
  link_to name, resource, attributes
104
123
  end
105
124
 
106
- def link_to_modal_delete(resource, options = {})
125
+ def link_to_modal_delete(options = {})
107
126
  name = ("<span class='glyphicon glyphicon-trash'></span>").html_safe
108
127
  attributes = {
109
- :class => 'btn btn-danger modal-delete-link col-md-12'
128
+ :class => 'btn btn-danger modal-delete-link col-md-12',
129
+ :data => {:confirm => nil}
110
130
  }.merge(options)
111
- link_to name, resource, attributes
131
+ link_to name, nil, attributes
112
132
  end
113
133
 
114
134
  def ajax_soft_delete(resource, options = {})
@@ -122,7 +142,6 @@ module PhantomHelpers
122
142
  link_to name, resource, attributes
123
143
  end
124
144
 
125
-
126
145
  def primary_checkbox
127
146
  ("<span class='glyphicon glyphicon-ok'></span>").html_safe
128
147
  end
@@ -220,6 +239,22 @@ module PhantomHelpers
220
239
  link_to name, resource, attributes
221
240
  end
222
241
 
242
+ def link_to_index(resource, options = {})
243
+ name = ('<span class="glyphicon glyphicon-share-alt"></span> '+ t(:'phantom_helpers.index')).html_safe
244
+ attributes = {
245
+ :class => 'col-md-12 btn btn-default index-link'
246
+ }.merge(options)
247
+ link_to name, resource, attributes
248
+ end
249
+
250
+ def link_to_report(resource, options = {})
251
+ name = ('<span class="glyphicon glyphicon-download-alt"></span> '+ t(:'phantom_helpers.report')).html_safe
252
+ attributes = {
253
+ :class => 'col-md-12 btn btn-default report-link'
254
+ }.merge(options)
255
+ link_to name, resource, attributes
256
+ end
257
+
223
258
  def submit_button(text, options={})
224
259
  text = ('<span class="glyphicon glyphicon-ok-circle"></span> '+ text).html_safe
225
260
  attributes = {
@@ -2,39 +2,68 @@ module PhantomHelpers
2
2
  module ViewHelpers
3
3
  module ModalHelper
4
4
 
5
- def close_button
6
- content_tag :button, :class => 'close', :'data-dismiss' => 'modal' do
7
- "&times".html_safe
5
+ def panel_for(id, type='default', &block)
6
+ content_tag :div, id: id, class: "panel panel-#{type}" do
7
+ block.call
8
+ end
9
+ end
10
+
11
+ def panel_header(text, object=nil)
12
+ content_tag :div, class: 'panel-heading clearfix' do
13
+ concat(content_tag(:h3, class: 'panel-title pull-left') { "#{text}"})
14
+ concat(content_tag(:h3, class: 'panel-title pull-right') { updated_at_text(object) }) if object
8
15
  end
9
16
  end
10
17
 
18
+ def updated_at_text(object)
19
+ "#{t(:'phantom_helpers.updated')}: #{time_ago_in_words(object.updated_at)} #{t(:'phantom_helpers.ago')}"
20
+ end
21
+
11
22
  def modal_for(id, &block)
12
23
  content_tag :div, class: "modal hide", id: id, wmode: "opaque" do
13
- block.call
24
+ content_tag :div, class: "col-md-12 alert-dismissable" do
25
+ block.call
26
+ end
14
27
  end
15
28
  end
16
29
 
17
- def modal_body(&block)
18
- content_tag :div, class: "modal-body" do
19
- content_tag :div, class: "row" do
20
- content_tag :div, class: "col-md-12" do
21
- content_tag :div, class: "well" do
22
- block.call
23
- end
30
+ def index_modal_for(id, &block)
31
+ content_tag :div, class: "modal hide", id: id, wmode: "opaque" do
32
+ content_tag :div, class: "col-md-12 alert-dismissable" do
33
+ content_tag :div, class: "panel panel-primary" do
34
+ block.call
24
35
  end
25
36
  end
26
37
  end
27
38
  end
28
39
 
40
+
41
+ def modal_body(&block)
42
+ content_tag(:div, class: "panel-body") do
43
+ block.call
44
+ end
45
+ end
46
+
29
47
  def modal_header(text)
30
- content_tag :div, class: "modal-header" do
31
- concat close_button
32
- concat content_tag(:h3) { text }
48
+ panel_title(text, modal_close_button)
49
+ end
50
+
51
+ private
52
+
53
+ def panel_title(title, close_button)
54
+ content_tag :div, class: "panel-heading" do
55
+ content_tag :h3, class: "panel-title" do
56
+ concat close_button
57
+ concat(title ||= ' ')
58
+ end
33
59
  end
34
60
  end
35
61
 
36
- def modal_form_error(id)
37
- content_tag :div, nil, :id => id
62
+
63
+ def modal_close_button
64
+ content_tag :button, :class => 'close', :'data-dismiss' => 'modal', :'aria-hidden' => true do
65
+ "&times".html_safe
66
+ end
38
67
  end
39
68
 
40
69
  end
@@ -5,7 +5,7 @@ module PhantomHelpers
5
5
  def table_for(id, &block)
6
6
  content_tag :div, class: "row" do
7
7
  content_tag :div, class: "col-md-12" do
8
- content_tag :table, class: "table table-striped table-bordered table-condensed mb-0", id: id do
8
+ content_tag :table, class: "table table-striped table-bordered table-condensed", id: id do
9
9
  block.call
10
10
  end
11
11
  end
data/locales/en.yml CHANGED
@@ -2,9 +2,15 @@ en:
2
2
  phantom_helpers:
3
3
  cancel: "Cancel"
4
4
  back: "Back"
5
+ index: Index
6
+ report: Generate Report
7
+ updated: updated
8
+ ago: ago
5
9
  picture:
6
10
  change: "Change picture"
7
11
  upload: "Upload picture"
8
12
  are_you_sure: "Are you sure?"
9
13
  edit: "Edit"
14
+ delete: Delete
15
+ confirm_delete: "Confirm delete?"
10
16
 
@@ -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.10.0'
5
+ s.version = '0.11.0.alpha1'
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.10.0
4
+ version: 0.11.0.alpha1
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-10-16 00:00:00.000000000 Z
13
+ date: 2013-10-24 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: rails helpers for bootstrap 3
16
16
  email: info@genshin.org
@@ -47,9 +47,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
47
47
  version: 1.8.7
48
48
  required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  requirements:
50
- - - '>='
50
+ - - '>'
51
51
  - !ruby/object:Gem::Version
52
- version: '0'
52
+ version: 1.3.1
53
53
  requirements:
54
54
  - none
55
55
  rubyforge_project: