<commit_before>%fieldset
  %h1
    Roles for
    = @object.name
  - if @object.roles.size == 0
    %p No roles found for user.
  - else
    %table
      %tr
        %th Role
      - @object.roles.each do |role|
        %tr{:class => cycle('even', 'odd')}
          %td
            = link_to(role.title.chars.capitalize, role, {:title => role.description})
.clear
.float_left
  %fieldset
    %legend Assign roles to the user
    - if @available_roles.size == 0
      %p.small (This user has all available roles.)
    - else
      - form_tag :action => 'process_role' do
        = hidden_field_tag :id, @object.id
        %div
          = label :user, :role
          = select_tag('role_id', options_from_collection_for_select(@available_roles, :id, :title))
        %div= submit_tag('Add role')
.float_right
  %fieldset
    %legend Remove roles from the user
    - # collect removable roles
    - removable_roles = @object.roles
    - message = "(This user has no assigned roles.)"
    - if @object == current_user
      - admin_role = Role.find_by_title('administrator')
      - result = removable_roles.reject! {|role| role.title.eql?('administrator')}
      - unless result.nil?
        - removable_roles = result
        - message = "(This user has no assigned roles which can be removed;<br/> you cannot remove the administrator role from yourself.)"
    - if removable_roles.size == 0
      %p.small= message
    - else
      - options = removable_roles.collect {|role| '<option id="' + role.id.to_s + '">' + role.title.chars.capitalize + '</option>'}.join
      - form_tag :action => 'process_role' do
        = hidden_field_tag :id, @object.id
        %div
          = label :user, :role
          = select_tag('role_id', options)
        %div
          = submit_tag('Remove role')
.clear<commit_msg>Id to value bugfix for select.<commit_after>%fieldset
  %h1
    Roles for
    = @object.name
  - if @object.roles.size == 0
    %p No roles found for user.
  - else
    %table
      %tr
        %th Role
      - @object.roles.each do |role|
        %tr{:class => cycle('even', 'odd')}
          %td
            = link_to(role.title.chars.capitalize, role, {:title => role.description})
.clear
.float_left
  %fieldset
    %legend Assign roles to the user
    - if @available_roles.size == 0
      %p.small (This user has all available roles.)
    - else
      - form_tag :action => 'process_role' do
        = hidden_field_tag :id, @object.id
        %div
          = label :user, :role
          = select_tag('role_id', options_from_collection_for_select(@available_roles, :id, :title))
        %div= submit_tag('Add role')
.float_right
  %fieldset
    %legend Remove roles from the user
    - # collect removable roles
    - removable_roles = @object.roles
    - message = "(This user has no assigned roles.)"
    - if @object == current_user
      - admin_role = Role.find_by_title('administrator')
      - result = removable_roles.reject! {|role| role.title.eql?('administrator')}
      - unless result.nil?
        - removable_roles = result
        - message = "(This user has no assigned roles which can be removed;<br/> you cannot remove the administrator role from yourself.)"
    - if removable_roles.size == 0
      %p.small= message
    - else
      - options = removable_roles.collect {|role| '<option value="' + role.id.to_s + '">' + role.title.chars.capitalize + '</option>'}.join
      - form_tag :action => 'process_role' do
        = hidden_field_tag :id, @object.id
        %div
          = label :user, :role
          = select_tag('role_id', options)
        %div
          = submit_tag('Remove role')
.clear
{'fraction_non_alphanumeric': 0.12685745734727574, 'fraction_numerical': 0.002201430930104568, 'mean_word_length': 2.3813953488372093, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '221451', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1138, 'n_words': 308}