various tweaks

This commit is contained in:
Andy Miller
2015-07-24 17:31:29 -06:00
parent 38c98f563d
commit d012b9d933
9 changed files with 46 additions and 35 deletions

View File

@@ -1,6 +1,8 @@
enabled: true
route: '/admin'
theme: grav
dashboard:
days_of_stats: 7
login:
enabled: true
route: null
@@ -11,6 +13,6 @@ popularity:
enabled: true
ignore: ['/test*','/modular']
history:
daily: 7
daily: 30
monthly: 12
visitors: 20

View File

@@ -95,9 +95,12 @@ class Popularity
}
// keep correct number as set by history
$count = intval($this->config->get('plugins.admin.popularity.history.daily', 7));
$count = intval($this->config->get('plugins.admin.popularity.history.daily', 30));
$total = count($this->daily_data);
$this->daily_data = array_slice($this->daily_data, $total - $count, $count, true);
if ($total > $count) {
$this->daily_data = array_slice($this->daily_data, -$count, $count, true);
}
file_put_contents($this->daily_file, json_encode($this->daily_data));
}
@@ -108,10 +111,13 @@ class Popularity
$this->daily_data = $this->getData($this->daily_file);
}
$limit = intval($this->config->get('plugins.admin.popularity.dashboard.days_of_stats', 7));
$chart_data = array_slice($this->daily_data, -$limit, $limit);
$labels = array();
$data = array();
foreach ($this->daily_data as $date => $count) {
foreach ($chart_data as $date => $count) {
$labels[] = date('D', strtotime($date));
$data[] = $count;
}
@@ -193,7 +199,7 @@ class Popularity
$data = array();
foreach ($this->monthly_data as $date => $count) {
$labels[] = date('M',strtotime($date));
$labels[] = date('M', strtotime($date));
$data[] = $count;
}
return array('labels' => $labels, 'data' => $data);

View File

@@ -1127,7 +1127,9 @@ tr {
stroke: rgba(255, 255, 255, 0.2) !important; }
#popularity .ct-chart {
margin-top: -10px; }
margin: 0 -10px -10px; }
#popularity .ct-chart .ct-chart-bar {
padding: 10px; }
.pages-list {
list-style: none;

File diff suppressed because one or more lines are too long

View File

@@ -23,7 +23,7 @@
};
SelectizeField.getTypes = function () {
return [ 'selectize', 'select' ];
return [ 'selectize', 'select'];
};
SelectizeField.prototype.valid = function() {

View File

@@ -481,6 +481,7 @@ $update-height: 3rem;
// Chart overrides
.ct-chart {
.ct-series {
.ct-bar {
stroke-width: 20px;
@@ -505,7 +506,10 @@ $update-height: 3rem;
}
#popularity .ct-chart {
margin-top: -10px;
margin: 0 -10px -10px;
.ct-chart-bar {
padding: 10px;
}
}
// Remodal Styling

View File

@@ -71,8 +71,8 @@
axisX: {
showGrid: false,
labelOffset: {
x: 15,
y: -5
x: 0,
y: 5
}
},
axisY: {
@@ -81,7 +81,7 @@
showGrid: true,
labelOffset: {
x: 5,
y: 0
y: 5
},
scaleMinSpace: 20
}

View File

@@ -1,7 +1,5 @@
{% extends "forms/field.html.twig" %}
{% set base_depth = 0 %}
{% macro options(field, pages, value, depth) %}
{% if field.show_root and depth == 0 %}
@@ -27,7 +25,9 @@
{% block global_attributes %}
data-grav-selectize="{{ (field.selectize is defined ? field.selectize : {})|json_encode()|e('html_attr') }}"
{{ parent() }}
data-grav-field="select"
data-grav-disabled="{{ originalValue is null ? 'true' : 'false' }}"
data-grav-default="{{ field.default|json_encode()|e('html_attr') }}"
{% endblock %}
{% block input %}

View File

@@ -1,21 +1,18 @@
{% extends "forms/field.html.twig" %}
{% set value = config.system.pages.theme %}
{% set options = {} %}
{% for slug, package in admin.themes %}
{% set option = {(slug): package.toArray().name} %}
{% set options = options|merge(option) %}
{% endfor %}
{% set field = {
type: 'select',
classes: 'fancy',
label: field.label,
name: field.name,
options: options
} %}
{% include ['forms/fields/select/select.html.twig'] %}
{% block input %}
<div class="form-select-wrapper {{ field.size }}">
<select class="{{ field.classes }}" name="{{ (scope ~ field.name)|fieldName ~ (field.multiple ? '[]' : '') }}"
{% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
{% if field.validate.required in ['on', 'true', 1] %}required="required"{% endif %}
{% if field.multiple in ['on', 'true', 1] %}multiple="multiple"{% endif %}
>
{% for slug, package in admin.themes %}
{% set theme = package.toArray() %}
<option
{% if config.system.pages.theme == slug %}selected="selected"{% endif %}
value="{{ slug }}">
{{ theme.name }}
</option>
{% endfor %}
</select>
</div>
{% endblock %}