ancestry-treeview 0.0.1 → 0.0.2

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: 32fc67a1525de8362af589df7bd1b6bdcfcbd58f
4
- data.tar.gz: a77601fffdaf5207a50ce98cb02a09bee67b7dea
3
+ metadata.gz: f0b31521037d453e7d8ead165e790c37b78baa5e
4
+ data.tar.gz: a96e55875fe4ac4a7386b740cf03a3aa644a379d
5
5
  SHA512:
6
- metadata.gz: 08e989cd2f5ca15594123ba634e47a4ddbd5602a02cf52cb8d770def7c7cf62fd8741a18eedf184f8ac5c69cbf9da6f2273ed80494a60a87fcb8eb182939124c
7
- data.tar.gz: 4b4ee0283bdadeec4d0efcc447804dace10fb53ca0d3d9a73efdf1bf7cf5621ea12e553d4a9eef525c4adfaa0a60a51d68573e46f32368eb523bac9df5f355d9
6
+ metadata.gz: fc9df7ee354de205dd430d4d16d68b6569faec7f83cbf100b83ce291fd7aea9738f4f6e56ef97bdb002a3fcdc59bfda3deb021eba9cd098c6d2a34e462143bd4
7
+ data.tar.gz: 12779fd96f0e65439fd49fba59f066adae4a8643d83ea36f143df12a921e6ea1abd06dc7acd073a6e5565f486218d5f6ff8f43944ffaeb51939703d05e59b907
@@ -1,6 +1,5 @@
1
1
  rvm:
2
2
  # - 1.8.7
3
- - 1.9.2
4
3
  - 1.9.3
5
4
  - 2.0.0
6
5
  gemfile:
data/README.md CHANGED
@@ -1,46 +1,42 @@
1
1
  # ancestry-treeview [![Build Status](https://secure.travis-ci.org/sonots/ancestry-treeview.png?branch=master)](http://travis-ci.org/sonots/ancestry-treeview) [![Dependency Status](https://gemnasium.com/sonots/ancestry-treeview.png)](https://gemnasium.com/sonots/ancestry-treeview)
2
2
 
3
- testing ruby: 1.9.2, 1.9.3, 2.0.0; ancestry: 2.0.0
3
+ testing ruby: 1.9.3, 2.0.0; ancestry: 2.0.0
4
4
 
5
- ## About OnePuch
6
-
7
- ancestry-treeview is an extension of ancestry gem to show a tree view which looks like http://jsfiddle.net/Fh47n/.
5
+ ancestry-treeview is an extension of `ancestry` gem to show a tree view which looks like http://jsfiddle.net/Fh47n/.
8
6
 
9
7
  ## Install
10
8
 
11
9
  gem install ancestry-treeview
12
10
 
13
- ## Dependencies
14
-
15
- jquery, and rails are required.
11
+ ## Usage
16
12
 
17
- ## Basic Usage
13
+ ### Basic Usage
18
14
 
19
- Add the following in your app/assets/stylesheets/application.css.scss
15
+ Add the following code in your `app/assets/stylesheets/application.css.scss`
20
16
 
21
17
  @import "ancestry-treeview";
22
18
 
23
19
  Then, call
24
20
 
25
- model.tree
26
-
27
- in your view where `model` is your `ancestry` model.
21
+ node.tree
28
22
 
29
- ## Custom Link
23
+ in your view where `node` is your `ancestry` model.
30
24
 
31
- As default, html links in the tree view are as
25
+ ### Custom Link
32
26
 
33
- <a href="#">id</a>
27
+ Default html links in the tree view are as
34
28
 
35
- You can change the htmll links by giving a block to `#tree` method as
29
+ <a href="#">id</a>
30
+
31
+ You can change the html link by giving a block as
36
32
 
37
- model.tree {|node| link_to("text", your_controller_path(node)) }
33
+ node.tree {|node| link_to("text", your_controller_path(node)) }
38
34
 
39
- ## Contraint Depth
35
+ ### Contraint Depth
40
36
 
41
- As default, all childrens of specified node is shown as a tree. Use `to_depth` option to contraint the depth
37
+ As default, all childrens of a node is shown as a tree. Use `to_depth` option to contraint the depth
42
38
 
43
- mode.tree(to_depth: 1)
39
+ node.tree(to_depth: 1)
44
40
 
45
41
  ## Acknowledgements
46
42
 
@@ -1,6 +1,7 @@
1
1
  #! /usr/bin/env gem build
2
2
  # encoding: utf-8
3
- require File.expand_path('../lib/ancestry/treeview//version', __FILE__)
3
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
4
+ require 'ancestry/treeview/version'
4
5
 
5
6
  Gem::Specification.new do |gem|
6
7
  gem.name = 'ancestry-treeview'
@@ -3,6 +3,9 @@ module Ancestry
3
3
  def tree(params = {})
4
4
  return '' unless self
5
5
  subtree = (params[:to_depth].present? ? self.subtree(to_depth: params[:to_depth]) : self.subtree).order('path ASC')
6
+ if params[:conditions].is_a?(Array) || params[:conditions].is_a?(Hash)
7
+ subtree = subtree.where(params[:conditions])
8
+ end
6
9
  html = '<div class="ancestry-treeview">'
7
10
  open_ul = 0
8
11
  prev_depth = self.depth - 1
@@ -1,5 +1,5 @@
1
1
  module Ancestry
2
2
  module Treeview
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ancestry-treeview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-23 00:00:00.000000000 Z
11
+ date: 2013-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ancestry
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  requirements: []
109
109
  rubyforge_project:
110
- rubygems_version: 2.0.0
110
+ rubygems_version: 2.0.3
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: An extension of ancestry gem to show a tree view