-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #958 from mconf/feature-stats-view
Feature stats view
- Loading branch information
Showing
19 changed files
with
782 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
$ -> | ||
if isOnPage 'manage', 'statistics' | ||
uri = window.location.href | ||
|
||
mconf.Resources.addToBind -> | ||
mconf.StatisticsFilter.bind() | ||
|
||
# only kept here because this link is inside a .btn-group that disables the default | ||
# click in the button, so we have to do the redirect it manually | ||
$('#statistics-filters .btn.all').on 'click', -> | ||
window.location.replace($(this).attr('href')) |
45 changes: 45 additions & 0 deletions
45
app/assets/javascripts/app/manage/statistics_filter.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
submitSelector = 'input[type=\'submit\']' | ||
|
||
class mconf.StatisticsFilter | ||
|
||
@bind: -> | ||
start = $(statistics_starts_on_time) | ||
end = $(statistics_ends_on_time) | ||
mconf.DateTimeInput.setStartDate(start, new Date('2010-01-01')) | ||
|
||
filterByDate() | ||
$('.starts-at-wrapper .btn-group .btn').on 'click', -> | ||
filterByDate(this) | ||
|
||
$('.datetime-picker-input').on 'change', -> | ||
checkDate() | ||
|
||
start.on 'change', -> | ||
limitMinimumEnd() | ||
|
||
end.on 'change', -> | ||
limitMaximumStart() | ||
|
||
filterByDate = (el) -> | ||
if el | ||
selected = $(el).data('attr-value') | ||
else | ||
selected = $('.starts-at-wrapper .btn.active').data('attr-value') | ||
|
||
limitMinimumEnd = -> | ||
startDate = statistics_starts_on_time.value | ||
|
||
if startDate != "" | ||
mconf.DateTimeInput.setStartDate($(statistics_ends_on_time), new Date(startDate)) | ||
|
||
limitMaximumStart = -> | ||
endDate = statistics_ends_on_time.value | ||
|
||
if endDate != "" | ||
mconf.DateTimeInput.setEndDate($(statistics_starts_on_time), new Date(endDate)) | ||
|
||
checkDate = -> | ||
startDate = statistics_starts_on_time.value | ||
endDate = statistics_ends_on_time.value | ||
|
||
$(submitSelector).removeAttr('disabled') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
@import "definitions"; | ||
@import "compass/css3"; | ||
|
||
body.manage.statistics { | ||
|
||
.page-tools-menu { | ||
padding-bottom: 5px; | ||
margin-bottom: 10px; | ||
|
||
.search-words { | ||
input { width: 100%; } | ||
} | ||
|
||
.search-filters { | ||
margin-top: 10px; | ||
|
||
.search-filter-option { | ||
margin-right: 5px; | ||
margin-bottom: 10px; | ||
} | ||
} | ||
} | ||
|
||
#statistics-filters { | ||
margin-bottom: 16px; | ||
@include mconf-clearfix; | ||
|
||
.csv { | ||
padding-top: 0; | ||
margin-top: 0; | ||
border-top: 0; | ||
float: right; | ||
} | ||
|
||
.btn-group { | ||
white-space: nowrap; | ||
float: left; | ||
|
||
> .btn { | ||
float: none; | ||
|
||
&:last-child { | ||
margin-left: -5px; | ||
} | ||
} | ||
} | ||
} | ||
|
||
#statistics-list { | ||
.table { | ||
margin-bottom: 30px; | ||
|
||
tbody td:first-child { | ||
width: 40%; | ||
} | ||
tbody td:last-child { | ||
width: 40%; | ||
} | ||
} | ||
}; | ||
|
||
.open-modal { | ||
text-decoration: none; | ||
color: black; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@import "definitions"; | ||
@import "compass/css3"; | ||
|
||
body.manage.statistics_filter { | ||
|
||
.text { | ||
font-size: 15px; | ||
margin: 0 15px; | ||
} | ||
|
||
.page-tools-menu { | ||
padding-bottom: 5px; | ||
margin-bottom: 10px; | ||
|
||
.search-words { | ||
input { width: 100%; } | ||
} | ||
|
||
.search-filters { | ||
margin-top: 10px; | ||
|
||
.search-filter-option { | ||
margin-right: 5px; | ||
margin-bottom: 10px; | ||
} | ||
} | ||
} | ||
|
||
.starts-at-wrapper { | ||
margin-bottom: 16px; | ||
|
||
.btn-group { | ||
white-space: nowrap; | ||
display: table-cell; | ||
width: 1%; | ||
|
||
> .btn { | ||
float: none; | ||
|
||
&:last-child { | ||
margin-left: -5px; | ||
} | ||
} | ||
} | ||
|
||
.form-group { | ||
display: table-cell; | ||
width: 100%; | ||
padding-left: 8px; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
-# locals: | ||
%div.table-wrapper | ||
|
||
%table.table | ||
%thead | ||
%tr | ||
%th{ colspan: 2 }= t('.users.title') | ||
%tbody | ||
%tr | ||
%td= t('.users.all') | ||
%td= @statistics[:users][:count] | ||
%tr | ||
%td= t('.users.approved') | ||
%td= @statistics[:users][:approved] | ||
%tr | ||
%td= t('.users.not_approved') | ||
%td= @statistics[:users][:not_approved] | ||
%tr | ||
%td= t('.users.disabled') | ||
%td= @statistics[:users][:disabled] | ||
|
||
%table.table | ||
%thead | ||
%tr | ||
%th{ colspan: 2 }= t('.spaces.title') | ||
%tbody | ||
%tr | ||
%td= t('.spaces.all') | ||
%td= @statistics[:spaces][:count] | ||
%tr | ||
%td= t('.spaces.private') | ||
%td= @statistics[:spaces][:private] | ||
%tr | ||
%td= t('.spaces.public') | ||
%td= @statistics[:spaces][:public] | ||
%tr | ||
%td= t('.spaces.disabled') | ||
%td= @statistics[:spaces][:disabled] | ||
|
||
%table.table | ||
%thead | ||
%tr | ||
%th{ colspan: 2 }= t('.meetings.title') | ||
%tbody | ||
%tr | ||
%td= t('.meetings.all') | ||
%td= @statistics[:meetings][:count] | ||
%tr | ||
%td= t('.meetings.total') | ||
%td | ||
- total = @statistics[:meetings][:total_duration] | ||
- if total.zero? | ||
= total | ||
- else | ||
= distance_of_time_in_words_to_now(Time.now + total, include_seconds: false) | ||
%tr | ||
%td= t('.meetings.average') | ||
%td | ||
- average = @statistics[:meetings][:average_duration] | ||
- if average.zero? | ||
= average | ||
- else | ||
= distance_of_time_in_words_to_now(Time.now + average, include_seconds: false) | ||
|
||
%table.table | ||
%thead | ||
%tr | ||
%th{ colspan: 2 }= t('.recordings.title') | ||
%tbody | ||
%tr | ||
%td= t('.recordings.all') | ||
%td= @statistics[:recordings][:count] | ||
%tr | ||
%td= t('.recordings.total') | ||
%td | ||
- total = @statistics[:recordings][:total_duration] | ||
- if total.zero? | ||
= total | ||
- else | ||
= distance_of_time_in_words_to_now(Time.now + total, include_seconds: false) | ||
%tr | ||
%td= t('.recordings.average') | ||
%td | ||
- average = @statistics[:recordings][:average_duration] | ||
- if average.zero? | ||
= average | ||
- else | ||
= distance_of_time_in_words_to_now(Time.now + average, include_seconds: false) | ||
%tr | ||
%td= t('.recordings.size') | ||
%td= human_file_size(@statistics[:recordings][:size]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#manage | ||
|
||
#statistics-filters | ||
= simple_form_for :statistics, url: manage_statistics_path, html: { class: 'single-column' } do |f| | ||
.csv | ||
- starts = params[:statistics].present? ? params[:statistics][:starts_on_time] : nil | ||
- ends = params[:statistics].present? ? params[:statistics][:ends_on_time] : nil | ||
= link_to t('.csv'), manage_statistics_csv_path(format: :csv, statistics: { starts_on_time: starts, ends_on_time: ends }), class: 'btn btn-primary' | ||
|
||
.btn-group{ 'data-toggle': "buttons" } | ||
|
||
= link_to manage_statistics_path, class: "btn btn-default all #{'active' unless params[:statistics].present?}" do | ||
= t('.all') | ||
= link_to manage_statistics_filter_path, class: "btn btn-default pick open-modal #{'active' if params[:statistics].present?}" do | ||
= icon_date | ||
= t('.date') | ||
|
||
#statistics-list{ 'data-filtered-by-date': params[:statistics].present?.to_s } | ||
= render partial: 'statistics_list' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#statistics_filter | ||
|
||
.modal-header | ||
= modal_close_button | ||
%h3 | ||
= t('.title') | ||
= simple_form_for :statistics, url: manage_statistics_path, method: "get", html: { class: 'single-column' } do |f| | ||
.modal-body | ||
.starts-at-wrapper | ||
- tz = user_timezone_abbreviation(current_user) | ||
- lang = locale_for_datetime_picker | ||
= f.label (t('.from')), required: false | ||
.start= f.input :starts_on_time, as: :datetime_picker, label: false, required: false, input_html: { 'data-format': t('_other.datetimepicker.datepick'), 'data-timezone': tz, 'data-language': lang, 'data-minview': 2 } | ||
= f.label (t('.to')), required: false | ||
.end= f.input :ends_on_time, as: :datetime_picker, label: false, required: false, input_html: { 'data-format': t('_other.datetimepicker.datepick'), 'data-timezone': tz, 'data-language': lang, 'data-minview': 2 } | ||
|
||
.modal-footer | ||
= f.button :wrapped, t('_other.send'), disabled: true, class: "btn btn-primary", cancel_modal: true |
Oops, something went wrong.