organizze-form 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 430bb1c85999b6cf744655697d01221be9c80120
4
+ data.tar.gz: e4118992bb155cfbd3393a397b3eef1ec1654596
5
+ SHA512:
6
+ metadata.gz: 53940347991c23f68aa08cfe52478be51402c9d4863439e16817324a15480aff2739a2840b4d42932a65fe758a4eb114f490b8f7c72915561285dde6f0eaa9e2
7
+ data.tar.gz: b206c4f04350158b855ac64b469376cd33124224135492b8a06c8705833591f94150dab5ab3a7c529e9d0d1c4b68b771af2bd579723125cbc97dc31222b25abb
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # organizze-form
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'organizze-form'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install organizze-form
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+
3
+ unless defined?(Motion::Project::Config)
4
+ raise "This file must be required within a RubyMotion project Rakefile."
5
+ end
6
+
7
+ lib_dir_path = File.dirname(File.expand_path(__FILE__))
8
+ Motion::Project::App.setup do |app|
9
+ app.files.unshift(Dir.glob(File.join(lib_dir_path, "organizze-form/**/*.rb")))
10
+ end
@@ -0,0 +1,26 @@
1
+ module OrganizzeForm
2
+ class Form
3
+ attr_reader :uuid, :sections
4
+
5
+ def initialize
6
+ @sections = []
7
+ @uuid = NSUUID.alloc.init.UUIDString
8
+ end
9
+
10
+ def section(&block)
11
+ _section = Section.new
12
+ @sections << _section
13
+ block.call _section
14
+ end
15
+
16
+ def cellFor(tableView, indexPath)
17
+ @tableView ||= WeakRef.new(tableView)
18
+ section = @sections[indexPath.section]
19
+ row = section.rows[indexPath.row]
20
+ cell_id = "form-cell-#{@uuid}-#{indexPath.section}-#{indexPath.row}".freeze
21
+ (tableView.dequeueReusableCellWithIdentifier(cell_id) || UITableViewCell.alloc.initWithStyle(UITableViewCellStyleDefault, reuseIdentifier: cell_id)).tap do |cell|
22
+ row.setup_cell(cell)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ module OrganizzeForm
2
+ module RowTypes
3
+ class ArrowSelect < Base
4
+ def setup_cell(cell)
5
+ cell.textLabel.text = 'teste'
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module OrganizzeForm
2
+ module RowTypes
3
+ class Base
4
+ attr_accessor :row
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,28 @@
1
+ module OrganizzeForm
2
+ class Row
3
+ attr_accessor :type, :key, :value
4
+
5
+ def row_type
6
+ @row_type ||= row_type_class.new.tap do |rt|
7
+ rt.row = WeakRef.new(self)
8
+ end
9
+ end
10
+
11
+ def setup_cell
12
+ row_type.setup_call
13
+ end
14
+
15
+ def row_type_class
16
+ "RowTypes::#{camelize(self.type)}".to_klass
17
+ end
18
+
19
+ def camelize(term)
20
+ parts = term.strip('_')
21
+ str = ''
22
+ for p in parts
23
+ str << p.capitalize
24
+ end
25
+ str
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ module OrganizzeForm
2
+ class Section
3
+ attr_reader :rows
4
+
5
+ def initialize
6
+ @rows = []
7
+ end
8
+
9
+ def row(&block)
10
+ _row = Row.new
11
+ @rows << _row
12
+ block.call _row
13
+ end
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: organizze-form
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Luis Felipe Colle da Luz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Simple rubymotion form helper for uiTableViews
28
+ email:
29
+ - solanoluz@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - README.md
35
+ - lib/organizze-form.rb
36
+ - lib/organizze-form/form.rb
37
+ - lib/organizze-form/row-types/arrow_select.rb
38
+ - lib/organizze-form/row-types/base.rb
39
+ - lib/organizze-form/row.rb
40
+ - lib/organizze-form/section.rb
41
+ homepage: ''
42
+ licenses:
43
+ - ''
44
+ metadata: {}
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubyforge_project:
61
+ rubygems_version: 2.4.1
62
+ signing_key:
63
+ specification_version: 4
64
+ summary: This gem helps you to deal with tableView forms way less intrusively than
65
+ formotion.
66
+ test_files: []