time_splitter 0.2.0 → 0.3.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: 3ae7e334a287a8d946e911dba08ba928346391d9
4
- data.tar.gz: 7639b9ea8eed95122d10ca476ae27115e132505e
3
+ metadata.gz: b4eeb1fc33ae43313893a99901f350a44039fe55
4
+ data.tar.gz: a98415d7d9391d9aa87e0639dc48bd45401d1967
5
5
  SHA512:
6
- metadata.gz: 4ccee3538dd7964342530d7e788b85bb9247d7fc6b9d5707528fb902487cc6cd3f77d0008ce552b88122dea458430288bf991f2e6ef053a1e292c3bf411278d7
7
- data.tar.gz: 6ec58eb45efb7dbc021436cb7b02ac75cb6b02105934cdb5c99f7a9e4fd93faa8eea5e73e8139422260303ae3b757cc47ed384c34d3ac629fe21ff20be84ca7e
6
+ metadata.gz: b4b2c3e0372b6398df5f03a39ddc8457795fa07a903a72d6a1f163c568563f6a1b692ce37267a3b4f4fcaf32a67736514fc7fe43aaac46816309c4f55851b221
7
+ data.tar.gz: d4decaa99d60ea5f34013c98f065854f32f29fc7b168775168c12165b816fb40ae9a16852758ba4203a45d8d329f4f912f96a72cc4ef54c124d4c580ffa4ab97
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/README.md CHANGED
@@ -1,12 +1,21 @@
1
1
  TimeSplitter
2
2
  ============
3
3
  [![Build Status](https://travis-ci.org/shekibobo/time_splitter.png)](https://travis-ci.org/shekibobo/time_splitter)
4
+ [![Gem Version](https://badge.fury.io/rb/time_splitter.png)](http://badge.fury.io/rb/time_splitter)
5
+ [![Code Climate](https://codeclimate.com/github/shekibobo/time_splitter.png)](https://codeclimate.com/github/shekibobo/time_splitter)
4
6
 
5
- Setting DateTimes can be a difficult or ugly thing, especially through a web form. Finding a good DatePicker or TimePicker is easy, but getting them to work on both can be difficult. TimeSplitter automatically generates accessors for `date`, `time`, `hour`, and `min` on any datetime or time attribute, making it trivial to use different form inputs to set different parts of a datetime field.
7
+ Setting DateTimes can be a difficult or ugly thing, especially through a web form. Finding a good DatePicker or TimePicker is easy, but getting them to work on both can be difficult. TimeSplitter automatically generates accessors for `date`, `time`, `hour`, and `min` on your datetime or time attributes, making it trivial to use different form inputs to set different parts of a datetime field.
6
8
 
7
9
  This gem is based on [SplitDatetime](https://github.com/michihuber/split_datetime) by [Michi Huber](https://github.com/michihuber). TimeSplitter improves on the gem, updating for Rails 4, adding `time` accessors, and providing a safer and more consistent default setting.
8
10
 
9
- ## Example Usage
11
+ ## Install
12
+
13
+ ### Standalone
14
+
15
+ `$ gem install time_splitter`
16
+
17
+ ### Gemfile
18
+
10
19
  In your `Gemfile`:
11
20
 
12
21
  ```ruby
@@ -36,6 +45,8 @@ In your view:
36
45
 
37
46
  Add your js datepicker and you're good to go. (Of course, this also works with standard Rails form helpers).
38
47
 
48
+ If you are using Rails < 4.0 and/or are not using StrongParameters, you must add the `attr_accessor` for any of the split attributes you want to permit mass-assignment. TimeSplitter provides the methods that can be directly accessed, but will not automatically whitelist any of them for mass-assignment.
49
+
39
50
  ## Options
40
51
 
41
52
  You can specify the date format for the view:
@@ -4,11 +4,6 @@ module TimeSplitter
4
4
  opts = { format: "%F" }.merge!(attrs.extract_options!)
5
5
 
6
6
  attrs.each do |attr|
7
- attr_accessible "#{attr}_date",
8
- "#{attr}_time",
9
- "#{attr}_hour",
10
- "#{attr}_min" if defined?(ActiveModel::MassAssignmentSecurity)
11
-
12
7
  # Maps the setter for #{attr}_time to accept multipart-parameters for Time
13
8
  composed_of "#{attr}_time".to_sym, class_name: 'DateTime' if self.respond_to?(:composed_of)
14
9
 
@@ -1,3 +1,3 @@
1
1
  module TimeSplitter
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_splitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michi Huber
@@ -48,6 +48,7 @@ executables: []
48
48
  extensions: []
49
49
  extra_rdoc_files: []
50
50
  files:
51
+ - .gitignore
51
52
  - .travis.yml
52
53
  - Gemfile
53
54
  - LICENSE