podemos-info/census

View on GitHub
app/views/scopes/browse.arb

Summary

Maintainability
Test Coverage
# frozen_string_literal: true

div class: "picker-header" do
  h2 t("census.scopes.picker.title", field: title)
  ul do
    unless root
      li do
        a href: browse_scopes_path(**context) do
          t("census.scopes.picker.world")
        end
      end
    end
    parent_scopes.each do |scope|
      li do
        a href: browse_scopes_path(current: scope.id, **context) do
          scope.name
        end
      end
    end
  end
end

div class: "picker-content" do
  div class: "picker-scrollable-content" do
    if scopes.any?
      ul do
        scopes.each do |scope|
          li do
            a href: browse_scopes_path(current: scope.id, **context) do
              scope.name
            end
          end
        end
      end
    end
  end
end

div class: "picker-footer" do
  div class: "buttons" do
    if current
      a class: "btn btn-ok", href: browse_scopes_path(current: current.id, **context), "data-picker-choose-value" => current.id, "data-picker-choose-text" => current.full_path do
        t("census.scopes.picker.choose")
      end
    else
      a class: "btn btn-disable", href: "#" do
        t("census.scopes.picker.choose")
      end
    end
    a class: "btn btn-cancel", href: "#", "data-modal-close" => "close" do
      t("census.scopes.picker.cancel")
    end
  end
end