render

in www/board/agenda/views/pages/action-items.js.rb [14:178]


  def render
    first = true

    _section.flexbox do
      _pre.report do
        @@item.actions.each do |action|

          
          if @@filter
            match = true
            @@filter.each_pair do |key, filter|
              match &&= (action[key] == filter)
            end
            next unless match
          end

          
          if first
            unless @@filter or Minutes.complete
              _p.alert_info 'Click on Status to update'
            end

            first = false
          else
            _ "\n"
          end

          
          _ "* #{action.owner}: #{action.text}\n      "

          if action.pmc and not (@@filter and @@filter.title)
            _ '[ '

            
            
            item = Agenda.find(action.pmc)
            if item
              _Link text: action.pmc, class: item.color, href: item.href
            elsif action.pmc
              _span.blank action.pmc
            end

            
            if action.date
              _ ' '
              agenda = "board_agenda_#{action.date.gsub('-', '_')}.txt"
              if Server.agendas.include? agenda
                _a action.date,
                  href: "../#{action.date}/#{action.pmc.gsub(/\W/, '-')}"
              else
                _a action.date, href:
                  '/board/minutes/' +
                  action.pmc.gsub(/\W/, '_') +
                  "#minutes_#{action.date.gsub('-', '_')}"
              end
            end
            _ " ]\n      "

          elsif action.date
            _ "[ #{action.date} ]\n      "
          end

          
          options = {on: {click: self.updateStatus}, class: ['clickable']}
          options = {} if Minutes.complete
          options.attrs = {}

          
          action.each_pair do |name, option|
            options.attrs["data-#{name}"] = option
          end

          
          pending = Pending.find_status(action)
          options.attrs['data-status'] = pending.status if pending

          Vue.createElement('span', options) do
            
            if pending
              _span "Status: "
              pending.status.split("\n").each do |line|
                match = line.match(/^( *)(.*)/)
                _span match[1]
                _em.commented "#{match[2]}\n"
              end
            elsif action.status == ''
              _span.missing 'Status:'
              _ "\n"
            else
              _Text raw: "Status: #{action.status}\n", filters: [hotlink]
            end
          end
        end

        if first
          _p {_em 'Empty'}
        end
      end

      if not first
        
        _ModalDialog id: 'updateStatusForm', color: 'commented' do
          _h4 'Update Action Item'

          _p do
            _span "#@owner: #@text"
            if @pmc
              _ ' [ '
              _span " #@pmc"  if @pmc
              _span " #@date" if @date
              _ ' ]'
            end
          end

          _textarea ref: 'statusText', label: 'Status:', value: @status, rows: 5

          _button.btn_default 'Cancel', data_dismiss: 'modal',
            disabled: @disabled
          _button.btn_primary 'Save', onClick: self.save,
            disabled: @disabled || (@baseline == @status)
        end
      end
    end

    
    if @@item.title == 'Action Items'
      captured = []
      Minutes.actions.each do |action|
        if @@filter
          match = true
          @@filter.each_pair do |key, filter|
            match &&= (action[key] == filter)
          end
          next unless match
        end

        captured << action
      end

      unless captured.empty?
        _section do
          _h3 'Action Items Captured During the Meeting'
          _pre.comment captured do |action|
            
            if @@filter
              match = true
              @@filter.each_pair do |key, filter|
                match &&= (action[key] == filter)
              end
              next unless match
            end

            _ "* #{action.owner}: #{action.text.gsub("\n", "\n        ")}\n"
            _ "      [ "
            if action.item
              _Link text: action.item.title, href: action.item.href,
                class: action.item.color
            end
            _ " #{Agenda.title} ]\n\n"
          end
        end
      end
    end
  end