Sha256: 4ea38424294b603d543e12e8e68518a0166ffca3b84ad4f60360b0ddcc3af125

Contents?: true

Size: 901 Bytes

Versions: 14

Compression:

Stored size: 901 Bytes

Contents

class Nav < Hyperloop::Component

  before_mount do
    mutate.user_name_input ''
  end

  render do
    div.navbar.navbar_inverse.navbar_fixed_top do
      div.container do
        div.collapse.navbar_collapse(id: 'navbar') do
          form.navbar_form.navbar_left(role: :search) do
            div.form_group do
              input.form_control(type: :text, value: state.user_name_input, placeholder: "Enter Your Handle"
              ).on(:change) do |e|
                mutate.user_name_input e.target.value
              end
              button.btn.btn_default(type: :button) { "login!" }.on(:click) do
                Operations::Join(user_name: state.user_name_input)
              end if valid_new_input?
            end
          end
        end
      end
    end
  end

  def valid_new_input?
    state.user_name_input.present? && state.user_name_input != MessageStore.user_name
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
hyper-operation-0.5.12 examples/chat-app/app/hyperloop/components/nav.rb
hyper-operation-0.5.11 examples/chat-app/app/hyperloop/components/nav.rb
hyper-operation-0.5.10 examples/chat-app/app/hyperloop/components/nav.rb
hyper-operation-0.5.9 examples/chat-app/app/hyperloop/components/nav.rb
hyper-operation-0.5.8 examples/chat-app/app/hyperloop/components/nav.rb
hyper-operation-0.5.7 examples/chat-app/app/hyperloop/components/nav.rb
hyper-operation-0.5.6 examples/chat-app/app/hyperloop/components/nav.rb
hyper-operation-0.5.5 examples/chat-app/app/hyperloop/components/nav.rb
hyper-operation-0.5.4 examples/chat-app/app/hyperloop/components/nav.rb
hyper-operation-0.5.3 examples/chat-app/app/hyperloop/components/nav.rb
hyper-operation-0.5.2 examples/chat-app/app/hyperloop/components/nav.rb
hyper-operation-0.5.1 examples/chat-app/app/hyperloop/components/nav.rb
hyper-model-0.6.0 examples/chat-app/app/hyperloop/components/nav.rb
hyper-operation-0.5.0 examples/chat-app/app/hyperloop/components/nav.rb