Sha256: 3b0a2e116571b540098fdf9155e585548c41b2c5dc405becd8f67a4fb576f163

Contents?: true

Size: 1.11 KB

Versions: 18

Compression:

Stored size: 1.11 KB

Contents

class LoginController < Formotion::FormController
  def init
    form = Formotion::Form.new({
      title: "Login",
      sections: [{
        rows: [{
          title: "User Name",
          type: :string,
          placeholder: "name",
          key: :user
        }, {
          title: "Password",
          type: :string,
          placeholder: "password",
          key: :password,
          secure: true
        }, {
          title: "Remember?",
          type: :switch,
          key: :remember,
          value: true
        }]
      }, {
        rows: [{
          title: "Login",
          type: :submit,
        }]
      }]
    })
    form.on_submit do
      self.login
    end
    super.initWithForm(form)
  end

  def viewDidLoad
    super
    self.navigationItem.rightBarButtonItem = UIBarButtonItem.alloc.initWithTitle("Login", style: UIBarButtonItemStyleDone, target:self, action:'login')
  end

  def login
    [:user, :password, :remember].each { |prop|
      UserController.controller.send(prop.to_s + "=", form.render[prop])
    }
    self.navigationController.dismissModalViewControllerAnimated(true)
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
formotion-1.8 examples/Login/app/login_controller.rb
formotion-1.7 examples/Login/app/login_controller.rb
formotion-1.6 examples/Login/app/login_controller.rb
formotion-1.5.1 examples/Login/app/login_controller.rb
formotion-1.5.0 examples/Login/app/login_controller.rb
formotion-1.4.0 examples/Login/app/login_controller.rb
formotion-1.3.1 examples/Login/app/login_controller.rb
formotion-1.3 examples/Login/app/login_controller.rb
formotion-1.2 examples/Login/app/login_controller.rb
formotion-1.1.5 examples/Login/app/login_controller.rb
formotion-1.1.4 examples/Login/app/login_controller.rb
formotion-1.1.3 examples/Login/app/login_controller.rb
formotion-1.1.2 examples/Login/app/login_controller.rb
formotion-1.1.1 examples/Login/app/login_controller.rb
formotion-1.1 examples/Login/app/login_controller.rb
formotion-1.0 examples/Login/app/login_controller.rb
formotion-0.5.1 examples/Login/app/login_controller.rb
formotion-0.5 examples/Login/app/login_controller.rb