Sha256: 16c28e468d3731ac2278c990dea93d12b746a3cb269b19466e101928c91ef21b

Contents?: true

Size: 1.46 KB

Versions: 22

Compression:

Stored size: 1.46 KB

Contents

<%# , url: { controller: "rolify", action: "update" }, html: { :turbo_method => :post } %>
<%= form_with(model: user, url: rolify_path(user)) do |form| %>

  <% if user.errors.any? %>
    <div style="color: red">
      <h2><%= pluralize(user.errors.count, "error") %> prohibited this user from being saved:</h2>

      <ul>
        <% user.errors.each do |error| %>
          <li><%= error.full_message %></li>
        <% end %>
      </ul>
    </div>
  <% end %>

  <p>
    <strong>Name:</strong>
    <%= user.name %>
  </p>

  <p>
    <strong>Email:</strong>
    <%= user.email %>
  </p>

  <p>
    <%= form.label :current_roles, style: "display: block" %>
    <%= user.roles.where(resource_type: nil).map { |role| role.name.capitalize }.to_sentence %>
  </p>

  <div>
    <%= form.label :raw_roles, style: "display: block" %>
    <pre>
    <code>
    <% user.roles.each do |role| %>
      <%= 
        extra_info = if role.resource_type
          " (#{role.resource_type}: #{role.resource_id})"
        else
          ""
        end
        "#{role.id} - #{role.name}, #{extra_info}"
      %>
    <% end %>
    </code>
    </pre>
  </div>

  <div>
    <%= form.label :user_roles, style: "display: block" %>
    <% Role.where(resource_type: nil).each do |role| %>
        <%= form.check_box :role_ids, { multiple: true, checked: user.role_ids.include?(role.id) }, role.id, nil %>
        <%= role.name %><br />
    <% end %>
    </ul>
  </div>

  <div>
    <%= form.submit %>
  </div>
<% end %>

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rails_app_generator-0.3.6 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.3.5 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.3.4 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.3.3 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.3.2 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.3.1 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.3.0 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.2.43 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.2.42 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.2.41 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.2.40 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.2.39 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.2.38 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.2.37 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.2.36 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.2.35 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.2.34 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.2.33 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.2.32 after_templates/addons/rolify/app/views/rolify/_form.html.erb
rails_app_generator-0.2.31 after_templates/addons/rolify/app/views/rolify/_form.html.erb