         opinion_views_ui.group_by = null
       save opinion_views_ui
 
-
-
     if opinion_views_ui.group_by
       all_groups = opinion_views.active_views.group_by.options
       group_colors = get_color_for_groups all_groups
+
+
+
+
+
 
     DIV 
       style:
         flex: 1
         paddingRight: 24
 
-      DIV null,
-        SPAN 
-          className: 'opinion_view_name'
+
+
+      DateFilters()
+
+
+      if attributes.length > 0 
+        DIV 
           style: 
-            paddingRight: 8
-          'Add opinion filter:'
-
-
-        UL 
-          style: 
-            listStyle: 'none'
-            display: 'inline'
+            marginTop: 18
+
+
+
+          DIV 
+            style: 
+              display: 'flex'
+            SPAN 
+              className: 'opinion_view_name'
+              style: 
+                paddingRight: 16
+                whiteSpace: 'nowrap'
+              'More filters:'
+
+
+            UL 
+              style: 
+                listStyle: 'none'
+                display: 'inline'
+
+
+              for attribute, cnt in attributes
+                continue if opinion_views_ui.visible_attributes[attribute.key]
+                do (attribute) ->
+                  LI 
+                    style: 
+                      display: 'inline-block'
+                    BUTTON
+                      className: 'filter opinion_view_button' 
+                      onClick: -> toggle_attribute_visible(attribute)
+                      onKeyDown: (e) => 
+                        if e.which == 13 || e.which == 32 # ENTER or SPACE
+                          toggle_attribute_visible(attribute)
+                          e.preventDefault()
+
+                      "+ #{attribute.name}"
 
 
           for attribute, cnt in attributes
-            continue if opinion_views_ui.visible_attributes[attribute.key]
-            do (attribute) ->
-              LI 
-                style: 
-                  display: 'inline-block'
+            continue if !opinion_views_ui.visible_attributes[attribute.key]
+            do (attribute) => 
+
+              DIV 
+                className: 'attribute_group'
+
                 BUTTON
-                  className: 'filter opinion_view_button' 
+                  className: 'attribute_group_header'
                   onClick: -> toggle_attribute_visible(attribute)
                   onKeyDown: (e) => 
                     if e.which == 13 || e.which == 32 # ENTER or SPACE
                       toggle_attribute_visible(attribute)
                       e.preventDefault()
 
-                  "+ #{attribute.name}"
-
-
-        for attribute, cnt in attributes
-          continue if !opinion_views_ui.visible_attributes[attribute.key]
-          do (attribute) => 
-
-            DIV 
-              className: 'attribute_group'
-
-              BUTTON
-                onClick: -> toggle_attribute_visible(attribute)
-                onKeyDown: (e) => 
-                  if e.which == 13 || e.which == 32 # ENTER or SPACE
-                    toggle_attribute_visible(attribute)
-                    e.preventDefault()
-
-                "#{attribute.name}"
-
-                SPAN 
-                  style: 
-                    float: 'right'
-                  'x'
-
-              UL 
-                style: 
-                  border: '1px solid #D9D9D9'
-                  borderTop: 'none'
-                  padding: '2px 4px 4px 4px'
-                  borderRadius: '0 0 8px 8px'
-
-                for val in attribute.options
-                  is_grouped = opinion_views_ui.group_by == attribute.key
-                  checked = !!opinion_views_ui.selected_vals_for_attribute[attribute.key][val]
-
-                  do (val) => 
-                    LI 
-                      style: 
-                        display: 'inline-block'
-                      LABEL 
-                        className: "attribute_value_selector"
-
-                        SPAN
-                          className: if is_grouped then 'toggle_switch' else ''
-
-                          INPUT 
-                            type: 'checkbox'
-                            # className: 'bigger'
-                            value: val
-                            checked: checked
-                            onChange: (e) ->
-                              # create a view on the fly for this attribute
-                              opinion_views_ui.selected_vals_for_attribute[attribute.key][val] = e.target.checked
-                              save opinion_views_ui
-                              update_view_for_attribute(attribute)
-
-                          if is_grouped
+                  "#{attribute.name}"
+
+                  SPAN 
+                    style: 
+                      float: 'right'
+                    'x'
+
+                if attribute.render 
+                  attribute.render()
+                else 
+                  UL 
+                    className: 'attribute_container' 
+
+                    for val in attribute.options
+                      is_grouped = opinion_views_ui.group_by == attribute.key
+                      checked = !!opinion_views_ui.selected_vals_for_attribute[attribute.key][val]
+
+                      do (val) => 
+                        LI 
+                          style: 
+                            display: 'inline-block'
+                          LABEL 
+                            className: "attribute_value_selector"
+
+                            SPAN
+                              className: if is_grouped then 'toggle_switch' else ''
+
+                              INPUT 
+                                type: 'checkbox'
+                                # className: 'bigger'
+                                value: val
+                                checked: checked
+                                onChange: (e) ->
+                                  # create a view on the fly for this attribute
+                                  opinion_views_ui.selected_vals_for_attribute[attribute.key][val] = e.target.checked
+                                  save opinion_views_ui
+                                  update_view_for_attribute(attribute)
+
+                              if is_grouped
+                                SPAN 
+                                  className: 'toggle_switch_circle'
+                                  style: 
+                                    backgroundColor: if checked then group_colors[val]
+
                             SPAN 
-                              className: 'toggle_switch_circle'
-                              style: 
-                                backgroundColor: if checked then group_colors[val]
-
-                        SPAN 
-                          className: 'attribute_value_value'
-                          "#{val}"
+                              className: 'attribute_value_value'
+                              "#{val}"
 
       if attributes.length > 0 
         cur_val = -1

            SPAN 
              className: 'opinion_view_name'
              style: 
                paddingRight: 8

              "Group opinions by: "  

            SELECT 
              style: 
                maxWidth: '100%'
                marginRight: 12
              onChange: (ev) -> 
                if ev.target.value != null
                  attribute = attributes[ev.target.value]

      user = fetch(u)
      user.key == fetch('/current_user').user

  by_date: 
    key: 'date'
    name: 'By date'
    pass: (u) ->
      true
    options: ['Today', 'Past week', 'Custom']


window.influence_network = {}
