rafaels88/pinfluence

View on GitHub
apps/admin/templates/moments/_form.html.erb

Summary

Maintainability
Test Coverage
<%=
  form_for form, class: 'ui form' do
    hidden_field :id

    div class: 'ui segment' do
      h4 'What/Who has influenced?', class: 'ui dividing header'

      div class: 'two fields' do
        fields_for :influencer do
          div class: 'field' do
            label "Type"
            select :type, Hash['Person', 'person'], class: "ui search dropdown"
          end

          div class: 'field' do
            label "Name"

            values = Hash[influencers_options.collect { |i| [i.name, i.id.to_s] }]
            select :id, values, options: { selected: person_id }, class: "ui search dropdown people"
          end
        end
      end

      hr class: "ui divider"

      h4 'Or create a new one', class: 'ui dividing header'
      div class: 'two fields' do

        fields_for :influencer do
          div class: 'field' do
            values = Hash["Male" => "male", "Female" => "female"]

            label :gender
            select :gender, values, class: "ui search dropdown gender"
          end

          div class: 'field' do
            label :name
            text_field :name
          end
        end
      end
    end

    div class: 'ui segment' do
      h4 'When it happend?', class: 'ui dividing header'

      div class: 'two fields' do
        div class: 'field' do
          label      "From Date"
          text_field :date_begin, placeholder: "Eg.: 1989-08-30"
        end

        div class: 'field' do
          label      "Until Date"
          text_field :date_end, placeholder: "(optional)"
        end
      end
    end

    div class: 'ui segment' do
      h4 'Where in the world?', class: 'ui dividing header'

      div class: 'two fields' do
        fields_for :locations do
          hidden_field :id, value: first_location_id

          div class: 'field' do
            label      "Location address"
            text_field :address, value: first_location_address, placeholder: "Eg.: Cairo, Egypt"
          end

          div class: 'field' do
            label      "Density"
            values = Hash[(1..10).to_a.collect { |d| [d, d] }]
            select :density, values, options: { selected: first_location_density }, class: "ui search dropdown"
          end
        end
      end
    end

    div class: 'field' do
      submit submit_label, class: 'ui teal button'
    end
  end
%>