ui_bibz 2.0.0.alpha18 → 2.0.0.alpha19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0074edb5080eef17f9af372db829881d7609c21c
4
- data.tar.gz: 13c3afee43afbfa0d19f67786603f401296aca8a
3
+ metadata.gz: 4090488e3b07a786d5eceaef52c25c08c34be127
4
+ data.tar.gz: d4d188984f0a959677b853d94a3f31153915a9bc
5
5
  SHA512:
6
- metadata.gz: 09b4dd02a5a9e1fc55164ca2e8916c64e9ee2b48be54da02c2f4d9d0e8414b64d7a00c9a46c329ce67083b7e1d9f16be435a0137a866cab32390dcaeb3c7970c
7
- data.tar.gz: 465db5b249cc8fa956b6f146b39c5dbec58d46c788bd434a293cb3acd0ff0e4fdf3c745ae1ea8f6e0e3593fb8198ff7ee155b04ad471c2b2a64306aba802c09f
6
+ metadata.gz: 48fd5d2cfa31cf68245d674440e9cee5ce07ffb18683175a564e0965dccb1c1ae01eac5f8c1c4abc4c8f23e1e48aac5c443edfd5ec35d34072233cd91f0afa3e
7
+ data.tar.gz: ab15956b2f5b95d0bf2221d8847e620c4f7f9b3f135630a5b40582bd7fdd4e7ee6a3cf433c857998b1abd6f2b476aae0953dc0ee2591b80f8264c83eee1376f0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ui_bibz (2.0.0.alpha18)
4
+ ui_bibz (2.0.0.alpha19)
5
5
  bootstrap (= 4.0.0.alpha3.1)
6
6
  font-awesome-sass
7
7
  haml
@@ -50,7 +50,7 @@
50
50
 
51
51
  .table>tbody>tr
52
52
  td:last-child
53
- height: 47px // Maybe find another way
53
+ padding: 0.50rem
54
54
  .dropdown-action
55
55
  display: none
56
56
 
@@ -0,0 +1,55 @@
1
+ require "will_paginate/view_helpers/action_view"
2
+
3
+ module PaginationHelper
4
+
5
+ module BootstrapRenderer
6
+
7
+ def to_html
8
+ html = pagination.map do |item|
9
+ item.is_a?(Fixnum) ?
10
+ page_number(item) :
11
+ send(item)
12
+ end.join(@options[:link_separator])
13
+
14
+ html = html_container(html) if @options[:container]
15
+
16
+ tag("nav", tag("ul", html, class: @options[:class]))
17
+ end
18
+
19
+ protected
20
+
21
+ def page_item(text, url, link_status = nil)
22
+ text = text.to_s + tag(:span, "(current)", class: "sr-only") if link_status == "active"
23
+ link_tag = link_status.nil? ? link(text, url, class: "page-link", rel: text) : tag(:span, text, class: "page-link")
24
+
25
+ tag(:li, link_tag, class: "page-item #{link_status}")
26
+ end
27
+
28
+ def page_number(page)
29
+ link_status = "active" if page == current_page
30
+ page_item(page, page, link_status)
31
+ end
32
+
33
+ def gap
34
+ text = @template.will_paginate_translate(:page_gap) { '…' }
35
+ page_item(text, nil, "disabled")
36
+ end
37
+
38
+ def previous_page
39
+ num = @collection.current_page > 1 && @collection.current_page - 1
40
+ previous_or_next_page(num, @options[:previous_label], "Previous")
41
+ end
42
+
43
+ def next_page
44
+ num = @collection.current_page < total_pages && @collection.current_page + 1
45
+ previous_or_next_page(num, @options[:next_label], "Next")
46
+ end
47
+
48
+ def previous_or_next_page(page, text, aria_label)
49
+ link_status = "disabled" unless page
50
+ page_item(text, page, link_status)
51
+ end
52
+ end
53
+ end
54
+
55
+ WillPaginate::ActionView::LinkRenderer.send :include, PaginationHelper::BootstrapRenderer
@@ -22,7 +22,7 @@ module UiBibz::Ui::Core::Cards
22
22
  # You can pass arguments in options attribute:
23
23
  # * +status+ - status of élement with symbol value:
24
24
  # (+:primary+, +:secondary+, +:info+, +:warning+, +:danger+)
25
- # * text_position - Symbole
25
+ # * text - Hash (+:size+, +:position+)
26
26
  # (+:left+, +:right+, +:center+)
27
27
  # * block - Boolean
28
28
  # * type - Symbol
@@ -131,15 +131,15 @@ module UiBibz::Ui::Core::Cards
131
131
  protected
132
132
 
133
133
  def component_html_classes
134
- ["card", text_position, card_block, type, tab_pane]
134
+ ["card", text, card_block, type, tab_pane]
135
135
  end
136
136
 
137
137
  def status
138
138
  "card-#{ @options[:status] }" unless @options[:status].nil?
139
139
  end
140
140
 
141
- def text_position
142
- "text-#{ @options[:text_position] }" unless @options[:text_position].nil?
141
+ def text
142
+ "text-#{ @options[:text][:size] || :md }-#{ @options[:text][:position] || :left }" unless @options[:text].nil?
143
143
  end
144
144
 
145
145
  def card_block
@@ -1,6 +1,7 @@
1
1
  require 'will_paginate'
2
2
  require "will_paginate-bootstrap"
3
3
  require "ui_bibz/ui/ux/tables/components/store"
4
+ require 'ui_bibz/helpers/pagination_helper'
4
5
  module UiBibz::Ui::Ux::Tables
5
6
 
6
7
  # Create a pagination for table
@@ -1,3 +1,3 @@
1
1
  module UiBibz
2
- VERSION = "2.0.0.alpha18"
2
+ VERSION = "2.0.0.alpha19"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ui_bibz
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.alpha18
4
+ version: 2.0.0.alpha19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thooams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-12 00:00:00.000000000 Z
11
+ date: 2016-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -231,6 +231,7 @@ files:
231
231
  - lib/tasks/ui_bibz_tasks.rake
232
232
  - lib/ui_bibz.rb
233
233
  - lib/ui_bibz/concerns/models/searchable.rb
234
+ - lib/ui_bibz/helpers/pagination_helper.rb
234
235
  - lib/ui_bibz/helpers/ui_core_helper.rb
235
236
  - lib/ui_bibz/helpers/ui_ux_helper.rb
236
237
  - lib/ui_bibz/helpers/utils_helper.rb