<commit_before>- page_title "Todos"
- header_title "Todos", dashboard_todos_path

.top-area
  %ul.nav-links
    - todo_pending_active = ('active' if params[:state].blank? || params[:state] == 'pending')
    %li{class: "todos-pending #{todo_pending_active}"}
      = link_to todos_filter_path(state: 'pending') do
        %span
          To do
        %span.badge
          = number_with_delimiter(todos_pending_count)
    - todo_done_active = ('active' if params[:state] == 'done')
    %li{class: "todos-done #{todo_done_active}"}
      = link_to todos_filter_path(state: 'done') do
        %span
          Done
        %span.badge
          = number_with_delimiter(todos_done_count)

  .nav-controls
    - if @todos.any?(&:pending?)
      = link_to destroy_all_dashboard_todos_path(todos_filter_params), class: 'btn btn-loading js-todos-mark-all', method: :delete do
        Mark all as done
        = icon('spinner spin')

.todos-filters
  .row-content-block.second-block
    = form_tag todos_filter_path(without: [:project_id, :author_id, :type, :action_id]), method: :get, class: 'filter-form' do
      .filter-item.inline
        - if params[:project_id].present?
          = hidden_field_tag(:project_id, params[:project_id])
        = dropdown_tag(project_dropdown_label(params[:project_id], 'Project'), options: { toggle_class: 'js-project-search js-filter-submit', title: 'Filter by project', filter: true, filterInput: 'input#search', dropdown_class: 'dropdown-menu-selectable dropdown-menu-project js-filter-submit',
          placeholder: 'Search projects', data: { data: todo_projects_options, selected: params[:project_id], field_name: 'project_id', default_label: 'Project' } })
      .filter-item.inline
        - if params[:author_id].present?
          = hidden_field_tag(:author_id, params[:author_id])
        = dropdown_tag(user_dropdown_label(params[:author_id], 'Author'), options: { toggle_class: 'js-user-search js-filter-submit js-author-search', title: 'Filter by author', filter: true, filterInput: 'input#search', dropdown_class: 'dropdown-menu-user dropdown-menu-selectable dropdown-menu-author js-filter-submit',
          placeholder: 'Search authors', data: { any_user: 'Any Author', first_user: (current_user.username if current_user), current_user: true, project_id: (@project.id if @project), selected: params[:author_id], field_name: 'author_id', default_label: 'Author' } })
      .filter-item.inline
        -# = select_tag('type', todo_types_options,
        -#   class: 'select2 trigger-submit', include_blank: true,
        -#   data: {placeholder: 'Type'})
      .filter-item.inline.actions-filter
        -# = select_tag('action_id', todo_actions_options,
        -#   class: 'select2 trigger-submit', include_blank: true,
        -#   data: {placeholder: 'Action'})

      .pull-right
        .dropdown.inline.prepend-left-10
          %button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'}
            %span.light
            - if @sort.present?
              = sort_options_hash[@sort]
            - else
              = sort_title_recently_created
            %b.caret
          %ul.dropdown-menu.dropdown-menu-align-right.dropdown-menu-sort
            %li
              = link_to todos_filter_path(sort: sort_value_priority) do
                = sort_title_priority
              = link_to todos_filter_path(sort: sort_value_recently_created) do
                = sort_title_recently_created
              = link_to todos_filter_path(sort: sort_value_oldest_created) do
                = sort_title_oldest_created


.prepend-top-default
  - if @todos.any?
    .js-todos-options{ data: {per_page: @todos.limit_value, current_page: @todos.current_page, total_pages: @todos.total_pages} }
    - @todos.group_by(&:project).each do |group|
      .panel.panel-default.panel-small
        - project = group[0]
        .panel-heading
          = link_to project.name_with_namespace, namespace_project_path(project.namespace, project)

        %ul.content-list.todos-list
          = render group[1]
    = paginate @todos, theme: "gitlab"
  - else
    .nothing-here-block You're all done!

:javascript
  new UsersSelect();

  $projectDropdown = $('.js-project-search');
  $projectDropdown.glDropdown({
    filterable: true,
    selectable: true,
    fieldName: 'project_id',
    data: $projectDropdown.data('data'),
    clicked: function() {
      if ($projectDropdown.hasClass('js-filter-submit')) {
        console.log('booM!');
        return $projectDropdown.closest('form').submit();
      }
    }
  });

  $('form.filter-form').on('submit', function (event) {
    event.preventDefault();
    Turbolinks.visit(this.action + '&' + $(this).serialize());
  });<commit_msg>Added type and action dropdowns, need to finalize by removing all inline and polishing off the selected dropdown states<commit_after>- page_title "Todos"
- header_title "Todos", dashboard_todos_path

.top-area
  %ul.nav-links
    - todo_pending_active = ('active' if params[:state].blank? || params[:state] == 'pending')
    %li{class: "todos-pending #{todo_pending_active}"}
      = link_to todos_filter_path(state: 'pending') do
        %span
          To do
        %span.badge
          = number_with_delimiter(todos_pending_count)
    - todo_done_active = ('active' if params[:state] == 'done')
    %li{class: "todos-done #{todo_done_active}"}
      = link_to todos_filter_path(state: 'done') do
        %span
          Done
        %span.badge
          = number_with_delimiter(todos_done_count)

  .nav-controls
    - if @todos.any?(&:pending?)
      = link_to destroy_all_dashboard_todos_path(todos_filter_params), class: 'btn btn-loading js-todos-mark-all', method: :delete do
        Mark all as done
        = icon('spinner spin')

.todos-filters
  .row-content-block.second-block
    = form_tag todos_filter_path(without: [:project_id, :author_id, :type, :action_id]), method: :get, class: 'filter-form' do
      .filter-item.inline
        - if params[:project_id].present?
          = hidden_field_tag(:project_id, params[:project_id])
        = dropdown_tag(project_dropdown_label(params[:project_id], 'Project'), options: { toggle_class: 'js-project-search js-filter-submit', title: 'Filter by project', filter: true, filterInput: 'input#search', dropdown_class: 'dropdown-menu-selectable dropdown-menu-project js-filter-submit',
          placeholder: 'Search projects', data: { data: todo_projects_options, selected: params[:project_id], field_name: 'project_id', default_label: 'Project' } })
      .filter-item.inline
        - if params[:author_id].present?
          = hidden_field_tag(:author_id, params[:author_id])
        = dropdown_tag(user_dropdown_label(params[:author_id], 'Author'), options: { toggle_class: 'js-user-search js-filter-submit js-author-search', title: 'Filter by author', filter: true, filterInput: 'input#search', dropdown_class: 'dropdown-menu-user dropdown-menu-selectable dropdown-menu-author js-filter-submit',
          placeholder: 'Search authors', data: { any_user: 'Any Author', first_user: (current_user.username if current_user), current_user: true, project_id: (@project.id if @project), selected: params[:author_id], field_name: 'author_id', default_label: 'Author' } })
      .filter-item.inline
        - if params[:type].present?
          = hidden_field_tag(:type, params[:type])
        = dropdown_tag(params[:type] || 'Type', options: { toggle_class: 'js-type-search js-filter-submit', dropdown_class: 'dropdown-menu-selectable dropdown-menu-type js-filter-submit',
          data: { data: todo_types_options, selected: params[:type], field_name: 'type', default_label: 'Type' } })
      .filter-item.inline.actions-filter
        - if params[:action_id].present?
          = hidden_field_tag(:action_id, params[:action_id])
        = dropdown_tag(params[:action_id] || 'Action', options: { toggle_class: 'js-action-search js-filter-submit', dropdown_class: 'dropdown-menu-selectable dropdown-menu-action js-filter-submit',
          data: { data: todo_actions_options, selected: params[:action_id], field_name: 'action_id', default_label: 'Action' } })
      .pull-right
        .dropdown.inline.prepend-left-10
          %button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'}
            %span.light
            - if @sort.present?
              = sort_options_hash[@sort]
            - else
              = sort_title_recently_created
            %b.caret
          %ul.dropdown-menu.dropdown-menu-align-right.dropdown-menu-sort
            %li
              = link_to todos_filter_path(sort: sort_value_priority) do
                = sort_title_priority
              = link_to todos_filter_path(sort: sort_value_recently_created) do
                = sort_title_recently_created
              = link_to todos_filter_path(sort: sort_value_oldest_created) do
                = sort_title_oldest_created


.prepend-top-default
  - if @todos.any?
    .js-todos-options{ data: {per_page: @todos.limit_value, current_page: @todos.current_page, total_pages: @todos.total_pages} }
    - @todos.group_by(&:project).each do |group|
      .panel.panel-default.panel-small
        - project = group[0]
        .panel-heading
          = link_to project.name_with_namespace, namespace_project_path(project.namespace, project)

        %ul.content-list.todos-list
          = render group[1]
    = paginate @todos, theme: "gitlab"
  - else
    .nothing-here-block You're all done!

:javascript
  new UsersSelect();

  $projectDropdown = $('.js-project-search');
  $projectDropdown.glDropdown({
    filterable: true,
    selectable: true,
    fieldName: 'project_id',
    data: $projectDropdown.data('data'),
    clicked: function() {
      if ($projectDropdown.hasClass('js-filter-submit')) {
        return $projectDropdown.closest('form').submit();
      }
    }
  });

  $typeDropdown = $('.js-type-search');
  $typeDropdown.glDropdown({
    selectable: true,
    fieldName: 'type_id',
    data: $typeDropdown.data('data'),
    clicked: function() {
      if ($typeDropdown.hasClass('js-filter-submit')) {
        return $typeDropdown.closest('form').submit();
      }
    }
  });

  $actionDropdown = $('.js-action-search');
  $actionDropdown.glDropdown({
    selectable: true,
    fieldName: 'action_id',
    data: $actionDropdown.data('data'),
    clicked: function() {
      if ($actionDropdown.hasClass('js-filter-submit')) {
        return $actionDropdown.closest('form').submit();
      }
    }
  });

  $('form.filter-form').on('submit', function (event) {
    event.preventDefault();
    Turbolinks.visit(this.action + '&' + $(this).serialize());
  });
{'fraction_non_alphanumeric': 0.13774362818590705, 'fraction_numerical': 0.0009370314842578711, 'mean_word_length': 3.2353174603174604, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6875754', 'n_tokens_mistral': 3403, 'n_tokens_neox': 3348, 'n_words': 611}