diff --git a/Formotion.gemspec b/Formotion.gemspec index 39b927f..18b4356 100644 --- a/Formotion.gemspec +++ b/Formotion.gemspec @@ -16,6 +16,5 @@ Gem::Specification.new do |s| s.license = 'MIT' s.add_dependency "bubble-wrap", ">= 1.4.0" - s.add_dependency "motion-require", ">= 0.1.0" s.add_development_dependency 'rake' end diff --git a/lib/formotion.rb b/lib/formotion.rb index bb694fc..d18698b 100644 --- a/lib/formotion.rb +++ b/lib/formotion.rb @@ -3,13 +3,14 @@ require 'bubble-wrap/font' require 'bubble-wrap/camera' -require 'motion-require' - -Motion::Require.all(Dir.glob(File.expand_path('../formotion/**/*.rb', __FILE__))) - Motion::Project::App.setup do |app| app.frameworks<<'CoreLocation' unless app.frameworks.include?('CoreLocation') app.frameworks<<'MapKit' unless app.frameworks.include?('MapKit') app.resources_dirs << File.join(File.dirname(__FILE__), '../resources') + + Dir.glob(File.join(File.dirname(__FILE__), 'formotion/**/*.rb')).each do |file| + app.files.unshift(file) + end + end diff --git a/lib/formotion/base.rb b/lib/formotion/base.rb index 86afbae..c5c1662 100644 --- a/lib/formotion/base.rb +++ b/lib/formotion/base.rb @@ -1,4 +1,4 @@ -motion_require 'row_type/base' + module Formotion class Base diff --git a/lib/formotion/controller/form_controller.rb b/lib/formotion/controller/form_controller.rb index 7976b17..a9681e8 100644 --- a/lib/formotion/controller/form_controller.rb +++ b/lib/formotion/controller/form_controller.rb @@ -1,4 +1,4 @@ -motion_require '../patch/ui_text_field' + ################# # diff --git a/lib/formotion/form/form.rb b/lib/formotion/form/form.rb index d33fead..0f2a33f 100644 --- a/lib/formotion/form/form.rb +++ b/lib/formotion/form/form.rb @@ -1,4 +1,4 @@ -motion_require "../base" + module Formotion class Form < Formotion::Base @@ -206,7 +206,7 @@ def render def sub_render kv = {} - rows = sections.map(&:rows).flatten + rows = sections.map { |x| x.rows }.flatten subform_rows = rows.select{ |row| row.subform != nil } subform_rows.each do |subform_row| kv[subform_row.key] = subform_row.subform.to_form.render diff --git a/lib/formotion/form/form_delegate.rb b/lib/formotion/form/form_delegate.rb index 352c5c0..c8dbda2 100644 --- a/lib/formotion/form/form_delegate.rb +++ b/lib/formotion/form/form_delegate.rb @@ -1,4 +1,4 @@ -motion_require "../base" + module Formotion class Form < Formotion::Base diff --git a/lib/formotion/row/row.rb b/lib/formotion/row/row.rb index 1719b37..383c9f7 100644 --- a/lib/formotion/row/row.rb +++ b/lib/formotion/row/row.rb @@ -1,4 +1,4 @@ -motion_require "../base" + module Formotion class Row < Formotion::Base @@ -236,7 +236,7 @@ def button? end def subform? - self.type.to_s == "subform" + !!(self.type.to_s =~ /^\w*subform$/) end def templated? diff --git a/lib/formotion/row_type/activity_view_row.rb b/lib/formotion/row_type/activity_view_row.rb index 5daf9b7..c8bb88b 100644 --- a/lib/formotion/row_type/activity_view_row.rb +++ b/lib/formotion/row_type/activity_view_row.rb @@ -1,4 +1,4 @@ -motion_require 'object_row' + module Formotion module RowType diff --git a/lib/formotion/row_type/back_row.rb b/lib/formotion/row_type/back_row.rb index 0e4ff41..e7952dc 100644 --- a/lib/formotion/row_type/back_row.rb +++ b/lib/formotion/row_type/back_row.rb @@ -1,4 +1,4 @@ -motion_require 'button' + module Formotion module RowType diff --git a/lib/formotion/row_type/button.rb b/lib/formotion/row_type/button.rb index de067a1..e1fea8d 100644 --- a/lib/formotion/row_type/button.rb +++ b/lib/formotion/row_type/button.rb @@ -1,4 +1,4 @@ -motion_require 'base' + module Formotion module RowType diff --git a/lib/formotion/row_type/check_row.rb b/lib/formotion/row_type/check_row.rb index a556cdf..f9c768d 100644 --- a/lib/formotion/row_type/check_row.rb +++ b/lib/formotion/row_type/check_row.rb @@ -1,4 +1,4 @@ -motion_require 'base' + module Formotion module RowType diff --git a/lib/formotion/row_type/currency_row.rb b/lib/formotion/row_type/currency_row.rb index 3653dcc..5676cd9 100644 --- a/lib/formotion/row_type/currency_row.rb +++ b/lib/formotion/row_type/currency_row.rb @@ -1,4 +1,4 @@ -motion_require 'number_row' + module Formotion module RowType diff --git a/lib/formotion/row_type/date_row.rb b/lib/formotion/row_type/date_row.rb index 675bd61..a4ae59a 100644 --- a/lib/formotion/row_type/date_row.rb +++ b/lib/formotion/row_type/date_row.rb @@ -1,5 +1,5 @@ -motion_require 'string_row' -motion_require 'multi_choice_row' + + module Formotion module RowType diff --git a/lib/formotion/row_type/edit_row.rb b/lib/formotion/row_type/edit_row.rb index 329ee7b..dc571b4 100644 --- a/lib/formotion/row_type/edit_row.rb +++ b/lib/formotion/row_type/edit_row.rb @@ -1,4 +1,4 @@ -motion_require 'button' + module Formotion module RowType diff --git a/lib/formotion/row_type/email_row.rb b/lib/formotion/row_type/email_row.rb index cb967e1..740e400 100644 --- a/lib/formotion/row_type/email_row.rb +++ b/lib/formotion/row_type/email_row.rb @@ -1,4 +1,4 @@ -motion_require 'string_row' + module Formotion module RowType diff --git a/lib/formotion/row_type/image_row.rb b/lib/formotion/row_type/image_row.rb index b33c214..45a570c 100644 --- a/lib/formotion/row_type/image_row.rb +++ b/lib/formotion/row_type/image_row.rb @@ -1,4 +1,4 @@ -motion_require 'base' + module Formotion module RowType diff --git a/lib/formotion/row_type/map_row.rb b/lib/formotion/row_type/map_row.rb index f29db8d..286e73f 100644 --- a/lib/formotion/row_type/map_row.rb +++ b/lib/formotion/row_type/map_row.rb @@ -1,4 +1,4 @@ -motion_require 'base' + module Formotion module RowType diff --git a/lib/formotion/row_type/number_row.rb b/lib/formotion/row_type/number_row.rb index 5c58e2b..7ff9013 100644 --- a/lib/formotion/row_type/number_row.rb +++ b/lib/formotion/row_type/number_row.rb @@ -1,4 +1,4 @@ -motion_require 'string_row' + module Formotion module RowType diff --git a/lib/formotion/row_type/object_row.rb b/lib/formotion/row_type/object_row.rb index 8c3b1c1..2a5fe19 100644 --- a/lib/formotion/row_type/object_row.rb +++ b/lib/formotion/row_type/object_row.rb @@ -1,4 +1,4 @@ -motion_require 'string_row' + module Formotion module RowType diff --git a/lib/formotion/row_type/options_row.rb b/lib/formotion/row_type/options_row.rb index 95f211e..afd2108 100644 --- a/lib/formotion/row_type/options_row.rb +++ b/lib/formotion/row_type/options_row.rb @@ -1,5 +1,5 @@ -motion_require 'base' -motion_require 'items_mapper' + + module Formotion module RowType diff --git a/lib/formotion/row_type/paged_image_row.rb b/lib/formotion/row_type/paged_image_row.rb index 22cf6d1..fa99023 100644 --- a/lib/formotion/row_type/paged_image_row.rb +++ b/lib/formotion/row_type/paged_image_row.rb @@ -1,4 +1,4 @@ -motion_require 'base' + # ideas taken from: # http://www.raywenderlich.com/10518/how-to-use-uiscrollview-to-scroll-and-zoom-content diff --git a/lib/formotion/row_type/phone_row.rb b/lib/formotion/row_type/phone_row.rb index 3d69a63..77ee8ef 100644 --- a/lib/formotion/row_type/phone_row.rb +++ b/lib/formotion/row_type/phone_row.rb @@ -1,4 +1,4 @@ -motion_require 'string_row' + module Formotion module RowType diff --git a/lib/formotion/row_type/picker_row.rb b/lib/formotion/row_type/picker_row.rb index 10d438a..563e3a4 100644 --- a/lib/formotion/row_type/picker_row.rb +++ b/lib/formotion/row_type/picker_row.rb @@ -1,6 +1,6 @@ # currently supports only one component -motion_require 'string_row' -motion_require 'multi_choice_row' + + module Formotion module RowType diff --git a/lib/formotion/row_type/slider_row.rb b/lib/formotion/row_type/slider_row.rb index 40302af..4cf50a8 100644 --- a/lib/formotion/row_type/slider_row.rb +++ b/lib/formotion/row_type/slider_row.rb @@ -1,4 +1,4 @@ -motion_require 'base' + module Formotion module RowType diff --git a/lib/formotion/row_type/static_row.rb b/lib/formotion/row_type/static_row.rb index 2241bfd..1c56649 100644 --- a/lib/formotion/row_type/static_row.rb +++ b/lib/formotion/row_type/static_row.rb @@ -1,4 +1,4 @@ -motion_require 'string_row' + module Formotion module RowType diff --git a/lib/formotion/row_type/string_row.rb b/lib/formotion/row_type/string_row.rb index 7a798fc..ba06a7d 100644 --- a/lib/formotion/row_type/string_row.rb +++ b/lib/formotion/row_type/string_row.rb @@ -1,4 +1,4 @@ -motion_require 'base' + module Formotion module RowType diff --git a/lib/formotion/row_type/subform_row.rb b/lib/formotion/row_type/subform_row.rb index 2b5034f..f1076b8 100644 --- a/lib/formotion/row_type/subform_row.rb +++ b/lib/formotion/row_type/subform_row.rb @@ -1,4 +1,4 @@ -motion_require 'base' + module Formotion module RowType diff --git a/lib/formotion/row_type/submit_row.rb b/lib/formotion/row_type/submit_row.rb index a9c203d..440a8e1 100644 --- a/lib/formotion/row_type/submit_row.rb +++ b/lib/formotion/row_type/submit_row.rb @@ -1,4 +1,4 @@ -motion_require 'button' + module Formotion module RowType diff --git a/lib/formotion/row_type/switch_row.rb b/lib/formotion/row_type/switch_row.rb index 4519221..c7afb45 100644 --- a/lib/formotion/row_type/switch_row.rb +++ b/lib/formotion/row_type/switch_row.rb @@ -1,4 +1,4 @@ -motion_require 'base' + module Formotion module RowType diff --git a/lib/formotion/row_type/tags_row.rb b/lib/formotion/row_type/tags_row.rb index 09cc0c4..fea210d 100644 --- a/lib/formotion/row_type/tags_row.rb +++ b/lib/formotion/row_type/tags_row.rb @@ -1,4 +1,4 @@ -motion_require 'base' + # ideas and images taken from: # https://github.com/davbeck/TURecipientBar diff --git a/lib/formotion/row_type/template_row.rb b/lib/formotion/row_type/template_row.rb index 6832cd2..963c759 100644 --- a/lib/formotion/row_type/template_row.rb +++ b/lib/formotion/row_type/template_row.rb @@ -1,4 +1,4 @@ -motion_require 'base' + # Define template row: # { diff --git a/lib/formotion/row_type/text_row.rb b/lib/formotion/row_type/text_row.rb index c1f91bd..c938e14 100644 --- a/lib/formotion/row_type/text_row.rb +++ b/lib/formotion/row_type/text_row.rb @@ -1,4 +1,4 @@ -motion_require 'base' + module Formotion module RowType diff --git a/lib/formotion/row_type/web_link_row.rb b/lib/formotion/row_type/web_link_row.rb index 692a49b..ddf25d5 100644 --- a/lib/formotion/row_type/web_link_row.rb +++ b/lib/formotion/row_type/web_link_row.rb @@ -1,4 +1,4 @@ -motion_require 'object_row' + module Formotion module RowType diff --git a/lib/formotion/row_type/web_view_row.rb b/lib/formotion/row_type/web_view_row.rb index 30cf631..dd7d9a1 100644 --- a/lib/formotion/row_type/web_view_row.rb +++ b/lib/formotion/row_type/web_view_row.rb @@ -1,4 +1,4 @@ -motion_require 'base' + module Formotion module RowType diff --git a/lib/formotion/section/section.rb b/lib/formotion/section/section.rb index f1a1b6f..4dcebb9 100644 --- a/lib/formotion/section/section.rb +++ b/lib/formotion/section/section.rb @@ -1,4 +1,4 @@ -motion_require "../base" + module Formotion class Section < Formotion::Base