hobo_bootstrap_ui 2.0.0.pre7 → 2.0.0.pre8

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,4 @@
1
- Additional UI tags for the [hobo_bootstrap theme](https://github.com/Hobo/hobo_bootstrap). Some of these tags are wrappers for the [bootstrap javascript components](twitter.github.com/bootstrap/javascript.html). Others are useful tags that are built on top of those javascript components.
2
-
3
- This plugin also includes an implementation of `<search-results-container>`, replacing the one in `hobo_jquery_ui`.
1
+ Additional UI tags for the [hobo_bootstrap theme](https://github.com/Hobo/hobo_bootstrap). Some of these tags are wrappers for the [bootstrap javascript components](twitter.github.com/bootstrap/javascript.html). Others are useful tags that are built on top of those javascript components. It pulls in the [bootstrap-datepicker-rails gem](https://github.com/Nerian/bootstrap-datepicker-rails), and can augment or replace the [hobo_jquery_ui](/plugins/hobo_jquery_ui) theme.
4
2
 
5
3
  ## Installation
6
4
 
@@ -12,22 +10,10 @@ This plugin also includes an implementation of `<search-results-container>`, rep
12
10
 
13
11
  ## Versus hobo_jquery_ui
14
12
 
15
- It is intended that this library will render [hobo_jquery_ui](https://github.com/Hobo/hobo_jquery_ui) and jquery-ui optional.
16
-
17
- At the moment, you can use hobo_bootstrap_ui instead of hobo_jquery_ui if you don't mind the loss of tags such as `<name-one>`.
18
-
19
- hobo_bootstrap_ui and hobo_jquery_ui may both be used in the same Hobo application. In the case of a conflict, the plugin loaded last will be used. `<search-results-container>` is the only current conflict, although hopefully we get bootstrap replacements for `<name-one>` and `<input for="Date">` soon.
20
-
21
- At the momemt, Hobo requires jQuery-UI even if hobo_jquery_ui is not used. We do plan on removing that dependency soon.
22
-
23
- ## TODO
24
-
25
- * replace `show` and `hide` in hjq.js to make jQuery-UI optional
26
-
27
- * implement `name-one` using bootstrap typeahead so that a Hobo application without hobo_jquery_ui is Hobo 1.3 compatible
28
-
29
- * implement replacements for the remainder of hobo_jquery_ui's tags.
13
+ You can use hobo_bootstrap_ui instead of hobo_jquery_ui if you don't mind the loss of tags such as `<sortable-collection>`.
30
14
 
15
+ Alternatively, hobo_bootstrap_ui and hobo_jquery_ui may both be used in the same Hobo application. In the case of overlap, the plugin loaded last will be used. Both plugins provide implementations of `<search-results-container>`, `<name-one>` and `<input for="Date">`. Both plugins have these tags available with non-shadowed names: `<name-one-bootstrap>` and `<bootstrap-datepicker>` for this gem.
31
16
 
17
+ If you use hobo_bootstrap_ui without hobo_jquery_ui, you can also remove jQuery-UI from your `app/assets/javascripts/application.js` as well as associated stylesheets. If you do this you will lose the ability to position the AJAX spinner and to use hide and show effects during part AJAX.
32
18
 
33
19
  [1]: https://github.com/Hobo/hobo_bootstrap_ui/raw/master/screenshots/select_one_or_new.png
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.pre7
1
+ 2.0.0.pre8
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.description = 'Additional UI tags for the hobo_bootstrap theme'
13
13
 
14
14
  s.add_runtime_dependency('hobo_bootstrap', "~> 2.0.0.pre1")
15
+ s.add_runtime_dependency('bootstrap-datepicker-rails')
15
16
 
16
17
  s.files = `git ls-files -x #{name}/* -z`.split("\0")
17
18
 
@@ -1,3 +1,9 @@
1
+ # Sub dependencies written in the gemspec are not loaded by default:
2
+ # http://stackoverflow.com/questions/6960078
3
+ # We need to require them here, so we can load the JS from bootstrap
4
+
5
+ require 'bootstrap-datepicker-rails'
6
+
1
7
  module HoboBootstrapUi
2
8
 
3
9
  VERSION = File.read(File.expand_path('../../VERSION', __FILE__)).strip
@@ -0,0 +1,58 @@
1
+ <!--
2
+ This is the [Bootstrap Datepicker](https://github.com/Nerian/bootstrap-datepicker-rails).
3
+
4
+ You can config some options. For example, to change the date format, language and weekstart you can add this to your front_site.dryml:
5
+
6
+ <def tag="input" for="Date">
7
+ <bootstrap-datepicker dateFormat="dd-mm-yyyy" language="es" weekstart="1" merge />
8
+ </def>
9
+
10
+ If you do not specify the format, it will attempt to convert I18n.t(:"date.formats.default") from strftime format into the format that the Bootstrap Datepicker likes. Take into account that it's not exactly the same as jquery_ui: year "2000" is represented by "yyyy" instead of "yy".
11
+
12
+ Another alternative to do the same is "extend. It's useful when you want to use "bootstrap-datepicker" directly in a form:
13
+
14
+ <extend tag="bootstrap-datepicker">
15
+ <old-bootstrap-datepicker dateFormat="dd-mm-yyyy" language="es" weekstart="1" merge/>
16
+ </extend>
17
+
18
+ -->
19
+
20
+ <def tag="bootstrap-datepicker" attrs="name, value">
21
+ <%
22
+ options, attrs = attributes.partition_hash(['format', 'weekstart', 'language', 'autoclose'])
23
+
24
+ options["autoclose"] ||= "true"
25
+ options["format"] ||= begin
26
+ d=I18n.t(:"date.formats.default")
27
+ {"%Y" => "yyyy",
28
+ "%y" => "yy",
29
+ "%m" => "mm",
30
+ "%_m" => "m",
31
+ "%-m" => "m",
32
+ "%B" => "MM",
33
+ "%^B" => "MM",
34
+ "%b" => "M",
35
+ "%^b" => "M",
36
+ "%h" => "M",
37
+ "%d" => "dd",
38
+ "%-d" => "d",
39
+ "%j" => "oo",
40
+ "%D" => "mm/dd/yy",
41
+ "%F" => "yy-mm-dd",
42
+ "%x" => "mm/dd/yy"}.each {|rb, js| d.gsub!(rb,js)}
43
+ d
44
+ end
45
+
46
+ if this && value.nil? && this.class == Date
47
+ value = I18n.l(this)
48
+ end
49
+
50
+ %>
51
+ <input name="#{name}" value="&value" type="text" class="bootstrap-datepicker"
52
+ data-date-format="#{options['format']}"
53
+ data-date-weekstart="#{options['weekstart']}"
54
+ data-date-autoclose="#{options['autoclose']}"
55
+ data-date-language="#{options['language']}"
56
+ merge-attrs
57
+ />
58
+ </def>
@@ -9,3 +9,13 @@
9
9
  <def tag="name-one">
10
10
  <name-one-bootstrap merge/>
11
11
  </def>
12
+
13
+ <!-- use bootstrap-datepicker for date inputs. To switch back to vanilla Rails (`<datepicker-rails>`) add to your application.dryml:
14
+
15
+ <def tag="input" for="Date">
16
+ <datepicker-rails merge/>
17
+ </def>
18
+ -->
19
+ <def tag="input" for="Date">
20
+ <bootstrap-datepicker merge />
21
+ </def>
@@ -0,0 +1,3 @@
1
+ $(function() {
2
+ $('.bootstrap-datepicker').datepicker();
3
+ });
@@ -1,2 +1,2 @@
1
1
  //= require_tree .
2
-
2
+ //= require bootstrap-datepicker
@@ -1,3 +1,4 @@
1
1
  /*
2
- *= require_tree .
3
- */
2
+ *= require_tree .
3
+ *= require bootstrap-datepicker
4
+ */
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hobo_bootstrap_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre7
4
+ version: 2.0.0.pre8
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-07 00:00:00.000000000 Z
12
+ date: 2013-02-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hobo_bootstrap
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 2.0.0.pre1
30
+ - !ruby/object:Gem::Dependency
31
+ name: bootstrap-datepicker-rails
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  description: Additional UI tags for the hobo_bootstrap theme
31
47
  email: ignacio@ihuerta.net
32
48
  executables: []
@@ -39,12 +55,14 @@ files:
39
55
  - lib/hobo_bootstrap_ui.rb
40
56
  - lib/hobo_bootstrap_ui/railtie.rb
41
57
  - screenshots/select_one_or_new.png
58
+ - taglibs/bootstrap_datepicker.dryml
42
59
  - taglibs/hobo_bootstrap_ui.dryml
43
60
  - taglibs/modal.dryml
44
61
  - taglibs/name_one_bootstrap.dryml
45
62
  - taglibs/overrides.dryml
46
63
  - taglibs/select_one_or_new.dryml
47
64
  - taglibs/typeahead.dryml
65
+ - vendor/assets/javascripts/hobo-bootstrap-ui/bootstrap-datepicker.js
48
66
  - vendor/assets/javascripts/hobo-bootstrap-ui/hjq-modal.js
49
67
  - vendor/assets/javascripts/hobo-bootstrap-ui/hjq-typeahead.js
50
68
  - vendor/assets/javascripts/hobo_bootstrap_ui.js
@@ -76,3 +94,4 @@ signing_key:
76
94
  specification_version: 3
77
95
  summary: Additional UI tags for the hobo_bootstrap theme
78
96
  test_files: []
97
+ has_rdoc: