stats.html.haml 2.03 KB
Newer Older
1
.container
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
  .row
    .col-md-3
      = render partial: "admins/admin_bar"
    .col-md-9
      %h1= t('.usage_statistic')

      .pull-right
        = form_tag('/admins/stats', :method => 'get', class: 'form-inline') do
          %select{:name => 'range'}
            %option{:value => 'daily', :selected => ('selected' if params[:range] == 'daily')}
              = t('.daily')
            %option{:value => 'week', :selected => ('selected' if params[:range] == 'week')}
              = t('.week')
            %option{:value => '2weeks', :selected => ('selected' if params[:range] == '2weeks')}
              = t('.2weeks')
            %option{:value => 'month', :selected => ('selected' if params[:range] == 'month')}
              = t('.month')

          = submit_tag t('.go'), class: 'btn btn-primary'

      %h3
        != t('.display_results', :segment => @segment)

      .row
        - [:posts, :comments, :aspect_memberships, :users].each do |name|
          - model = eval("@#{name.to_s}")
          - if name == :aspect_memberships
            - name = t('.shares', :count => model[:yesterday])
          - if name == :posts
            - name = t('.posts', :count => model[:yesterday])
          - if name == :comments
            - name = t('.comments', :count => model[:yesterday])
          - if name == :users
            - name = t('.users', :count => model[:yesterday])

          .col-md-3
            %h2{:style => 'font-weight:bold;'}
              = name.to_s
            %h4
              = model[:day_before]
              %span.percent_change{:class => (model[:change] > 0 ? "green" : "red")}
                = "(#{model[:change]}%)"

      .row
        .col-md-12
          %p.alert.alert-info.text-center
            != t('.current_segment', :post_yest => @posts[:yesterday]/@user_count.to_f, :post_day => @posts[:day_before]/@user_count.to_f)

      .row
        .col-md-12
          %h3= t('.50_most')
          %ul
          - @popular_tags.each do |name,count|
            %li
              != t('.tag_name', :name_tag => name, :count_tag => count)