Merge branch 'develop' into feature/admin-gpm-dependencies

This commit is contained in:
Flavio Copes
2016-03-26 18:00:19 +01:00
14 changed files with 78 additions and 37 deletions

View File

@@ -107,7 +107,22 @@ class AdminController
} else {
$nonce = $this->grav['uri']->param('admin-nonce');
}
if (!$nonce || !Utils::verifyNonce($nonce, 'admin-form')) {
if (!$nonce || !Utils::verifyNonce($nonce, 'admin-form'))
{
if ($this->task == 'addmedia') {
$message = sprintf($this->admin->translate('PLUGIN_ADMIN.FILE_TOO_LARGE', null, true), ini_get('post_max_size'));
//In this case it's more likely that the image is too big than POST can handle. Show message
$this->admin->json_response = [
'status' => 'error',
'message' => $message
];
return false;
}
$this->admin->setMessage($this->admin->translate('PLUGIN_ADMIN.INVALID_SECURITY_TOKEN'), 'error');
$this->admin->json_response = [
'status' => 'error',

View File

@@ -484,6 +484,7 @@ PLUGIN_ADMIN:
FILE_ERROR_UPLOAD: "An error occurred while trying to upload the file"
FILE_UNSUPPORTED: "Unsupported file type"
ADD_ITEM: "Add item"
FILE_TOO_LARGE: "The file is too large to be uploaded, maximum allowed is %s according <br>to your PHP settings. Increase your `post_max_size` PHP setting"
INSTALLING: "Installing"
LOADING: "Loading.."
DEPENDENCIES_NOT_MET_MESSAGE: "The following dependencies need to be fulfilled first:"

View File

@@ -4,6 +4,7 @@ form:
- name: username
type: text
label: PLUGIN_ADMIN.USERNAME
autofocus: true
placeholder: "lowercase chars only, e.g. 'admin'"
validate:
required: true

View File

@@ -149,12 +149,19 @@ export default class ColorpickerField {
}
reposition() {
let ct = $('.content-wrapper')[0];
let offset = this.element[0].getBoundingClientRect();
let ct = $('.content-wrapper')[0].getBoundingClientRect();
let ctOffset = ct.getBoundingClientRect();
let delta = { x: 0, y: 0 };
if (this.options.offset) {
delta.x = this.options.offset.x || 0;
delta.y = this.options.offset.y || 0;
}
this.wrapper.css({
top: offset.top + offset.height - ct.top,
left: offset.left - ct.left
top: offset.top + offset.height + ct.scrollTop - ctOffset.top + delta.y,
left: offset.left + ct.scrollLeft - ctOffset.left + delta.x
});
}
@@ -206,9 +213,10 @@ export default class ColorpickerField {
let phi;
// Touch support
if (event && event.changedTouches) {
x = (event.changedTouches ? event.changedTouches[0].pageX : 0) - offsetX;
y = (event.changedTouches ? event.changedTouches[0].pageY : 0) - offsetY;
let touchEvents = event.changedTouches || (event.originalEvent && event.originalEvent.changedTouches);
if (event && touchEvents) {
x = (touchEvents ? touchEvents[0].pageX : 0) - offsetX;
y = (touchEvents ? touchEvents[0].pageY : 0) - offsetY;
}
if (event && event.manualOpacity) {

View File

@@ -6,20 +6,16 @@ $('[name="task"][value="saveas"], [name="task"][value="switchlanguage"]').on('mo
let form = $(`#${element.attr('form')}`);
if (!form.length) { return; }
fields.forEach((field) => {
let value = element.attr(field);
if (!value) { return; }
let input = form.find(`[name="${field}"]`);
let input = form.find(`[name="data[${field}]"]`);
if (!input.length) {
input = $(`<input type="hidden" name="${field}" value="" />`);
input = $(`<input type="hidden" name="data[${field}]" value="" />`);
form.append(input);
}
input.val(value);
});
return true;

View File

@@ -1 +1,3 @@
@font-face{font-family:"Montserrat";font-weight:400;font-style:normal;src:url("../fonts/Montserrat-regular/Montserrat-regular.eot");src:url("../fonts/Montserrat-regular/Montserrat-regular.eot?#iefix") format("embedded-opentype"),local("Montserrat-regular"),url("../fonts/Montserrat-regular/Montserrat-regular.woff2") format("woff2"),url("../fonts/Montserrat-regular/Montserrat-regular.woff") format("woff"),url("../fonts/Montserrat-regular/Montserrat-regular.ttf") format("truetype"),url("../fonts/Montserrat-regular/Montserrat-regular.svg#Montserrat") format("svg")}@font-face{font-family:"Lato";font-weight:300;font-style:normal;src:url("../fonts/Lato-300/Lato-300.eot");src:url("../fonts/Lato-300/Lato-300.eot?#iefix") format("embedded-opentype"),local("Lato-300"),url("../fonts/Lato-300/Lato-300.woff2") format("woff2"),url("../fonts/Lato-300/Lato-300.woff") format("woff"),url("../fonts/Lato-300/Lato-300.ttf") format("truetype"),url("../fonts/Lato-300/Lato-300.svg#Lato") format("svg")}@font-face{font-family:"Lato";font-weight:400;font-style:normal;src:url("../fonts/Lato-regular/Lato-regular.eot");src:url("../fonts/Lato-regular/Lato-regular.eot?#iefix") format("embedded-opentype"),local("Lato-regular"),url("../fonts/Lato-regular/Lato-regular.woff2") format("woff2"),url("../fonts/Lato-regular/Lato-regular.woff") format("woff"),url("../fonts/Lato-regular/Lato-regular.ttf") format("truetype"),url("../fonts/Lato-regular/Lato-regular.svg#Lato") format("svg")}@font-face{font-family:"Lato";font-weight:700;font-style:normal;src:url("../fonts/Lato-700/Lato-700.eot");src:url("../fonts/Lato-700/Lato-700.eot?#iefix") format("embedded-opentype"),local("Lato-700"),url("../fonts/Lato-700/Lato-700.woff2") format("woff2"),url("../fonts/Lato-700/Lato-700.woff") format("woff"),url("../fonts/Lato-700/Lato-700.ttf") format("truetype"),url("../fonts/Lato-700/Lato-700.svg#Lato") format("svg")}@font-face{font-family:"Inconsolata";font-weight:400;font-style:normal;src:url("../fonts/Inconsolata-regular/Inconsolata-regular.eot");src:url("../fonts/Inconsolata-regular/Inconsolata-regular.eot?#iefix") format("embedded-opentype"),local("Inconsolata-regular"),url("../fonts/Inconsolata-regular/Inconsolata-regular.woff2") format("woff2"),url("../fonts/Inconsolata-regular/Inconsolata-regular.woff") format("woff"),url("../fonts/Inconsolata-regular/Inconsolata-regular.ttf") format("truetype"),url("../fonts/Inconsolata-regular/Inconsolata-regular.svg#Inconsolata") format("svg")}@font-face{font-family:"Inconsolata";font-weight:700;font-style:normal;src:url("../fonts/Inconsolata-700/Inconsolata-700.eot");src:url("../fonts/Inconsolata-700/Inconsolata-700.eot?#iefix") format("embedded-opentype"),local("Inconsolata-700"),url("../fonts/Inconsolata-700/Inconsolata-700.woff2") format("woff2"),url("../fonts/Inconsolata-700/Inconsolata-700.woff") format("woff"),url("../fonts/Inconsolata-700/Inconsolata-700.ttf") format("truetype"),url("../fonts/Inconsolata-700/Inconsolata-700.svg#Inconsolata") format("svg")}body,h5,h6,.badge,.note,.grav-mdeditor-preview,input,select,textarea,button,.selectize-input{font-family:"Lato","Helvetica","Tahoma","Geneva","Arial",sans-serif}h1,h2,h3,h4,#admin-menu li,.form-tabs>label,.label{font-family:"Montserrat","Helvetica","Tahoma","Geneva","Arial",sans-serif}code,kbd,pre,samp,body .CodeMirror{font-family:"Inconsolata","Monaco","Consolas","Lucida Console",monospace !important}
/*# sourceMappingURL=fonts.css.map */

File diff suppressed because one or more lines are too long

View File

@@ -15,7 +15,7 @@
"dependencies": {
"bootstrap": "^3.3.6",
"chartist": "^0.9.7",
"codemirror": "^5.12.0",
"codemirror": "^5.13.0",
"cookies-js": "^1.2.2",
"debounce": "^1.0.0",
"dropzone": "^4.3.0",
@@ -24,7 +24,7 @@
"gemini-scrollbar": "^1.3.2",
"immutable": "^3.7.6",
"immutablediff": "^0.4.2",
"js-yaml": "^3.5.3",
"js-yaml": "^3.5.5",
"mout": "^0.12.0",
"remodal": "^1.0.6",
"selectize": "^0.12.1",
@@ -35,12 +35,12 @@
"whatwg-fetch": "^0.11.0"
},
"devDependencies": {
"babel-core": "^6.6.4",
"babel-core": "^6.7.2",
"babel-loader": "^6.2.4",
"babel-polyfill": "^6.6.1",
"babel-polyfill": "^6.7.2",
"babel-preset-es2015": "^6.6.0",
"css-loader": "^0.23.1",
"eslint": "^2.2.0",
"eslint": "^2.4.0",
"eslint-loader": "^1.3.0",
"exports-loader": "^0.6.3",
"gulp": "^3.9.1",

View File

@@ -1,11 +1,9 @@
.g-colorpicker {
@extend %g-transparent-bg;
position: relative;
border-radius: $core-border-radius;
max-width: 100%;
input {
color: #333;
width: 100% !important;
}
@@ -30,18 +28,12 @@
.g-colorpicker-preview {
position: absolute;
top: -1px;
right: -1px;
bottom: -1px;
left: -1px;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
border-radius: 0 3px 3px 0;
}
&.light-text {
input, i {
color: $white;
}
}
}
.cp-sprite {
@@ -52,7 +44,7 @@
.cp-wrapper {
position: absolute;
width: 173px;
height: 208px;
height: 211px;
background: white;
border: solid 1px #CCC;
box-shadow: 0 0 20px rgba(0, 0, 0, .2);

View File

@@ -0,0 +1,26 @@
{% extends "forms/field.html.twig" %}
{% set default_php_dateformat = "d-m-Y H:i" %}
{% set php_dateformat = config.system.pages.dateformat.default ?: default_php_dateformat %}
{% set js_dateformat = admin.dateformatToMomentJS(php_dateformat) %}
{% set value = (value is null ? field.default : value) %}
{% set value = (value is null ? value : value|date(php_dateformat)) %}
{% block input %}
<div class="form-input-wrapper datetime-picker-wrapper {{ field.size }}">
<input
name="{{ (scope ~ field.name)|fieldName }}"
value="{{ value|e('html_attr')|join(', ') }}"
{% block input_attributes %}
type="text"
data-grav-datetime="{{ {'format': js_dateformat} | json_encode | e('html_attr') }}"
{% if field.validate.min %}min="{{ (field.validate.min is null ? field.validate.min : field.validate.min|date(php_dateformat)) }}"{% endif %}
{% if field.validate.max %}max="{{ (field.validate.max is null ? field.validate.max : field.validate.max|date(php_dateformat)) }}"{% endif %}
{{ parent() }}
{% endblock %}
/>
<span class="field-icons">
<i class="fa fa-fw fa-calendar"></i>
</span>
</div>
{% endblock %}

View File

@@ -17,7 +17,7 @@
{% for page in pages.children %}
{% if page.routable() or field.show_all %}
<option {% if page.route == value %}selected="selected"{% endif %} value="{{ page.route }}">
<option {% if page.route == value or (field.multiple and page.route in value) %}selected="selected"{% endif %} value="{{ page.route }}">
{{indent}} {{ page.menu }}
</option>
{% endif %}

View File

@@ -1,8 +1,6 @@
<div class="form-field grid user-details">
<div class="form-label block size-1-3">
<label><img src="https://www.gravatar.com/avatar/{{ data.email|md5 }}?s=128" /></label>
</div>
<div class="form-data block size-2-3">
<h2>{{ data.fullname }}</h2>