Skip to content

Commit

Permalink
Merge remote-tracking branch 'drmartin/ss4'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.editorconfig
#	code-of-conduct.md
#	composer.json
#	src/Fields/SliderField.php
  • Loading branch information
Damian Mooyman committed Jan 25, 2018
2 parents 821cae4 + 0fc806d commit a1146c6
Show file tree
Hide file tree
Showing 19 changed files with 14,002 additions and 107 deletions.
1 change: 1 addition & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment: false
16 changes: 10 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# For more information about the properties used in this file,
# please see the EditorConfig documentation:
# http://editorconfig.org
# For more information about the properties used in
# this file, please see the EditorConfig documentation:
# http://editorconfig.org/

[*]
charset = utf-8
Expand All @@ -10,8 +10,12 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[{*.yml,package.json}]
[*.md]
trim_trailing_whitespace = false

[*.{yml,js,json,css,scss,eslintrc,feature}]
indent_size = 2
indent_style = space

# The indent size used in the package.json file cannot be changed:
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
[composer.json]
indent_size = 4
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules/
/**/*.js.map
/**/*.css.map
4 changes: 2 additions & 2 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ This module adds a SliderField that allows you to enter a numeric value with a d

## Requirements

* SilverStripe 3 or above
* SilverStripe 4 or above

## Installation Instructions

* Extract all files into the 'sliderfield' folder under your Silverstripe root, or install using composer

```bash
composer require "tractorcow/silverstripe-sliderfield" "3.0.*@dev"
composer require "tractorcow/silverstripe-sliderfield"
```

## Usage
Expand Down
2 changes: 2 additions & 0 deletions _config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php

2 changes: 1 addition & 1 deletion _config/sliderfield.yml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Name: sliderfieldconfig
---
SliderField:
TractorCow\SliderField\SliderField:
default_minimum: 0
default_maximum: 100
1 change: 1 addition & 0 deletions client/dist/js/sliderfield.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/dist/styles/sliderfield.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.ui-slider-range{padding:0}.slide-controller{margin:5px;max-width:500px}
45 changes: 45 additions & 0 deletions client/src/bundles/sliderfield.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

import jQuery from 'jquery';

jQuery.entwine('ss', ($) => {
$('input.slider').entwine({
getMin() {
return this.data('min');
},
getMax() {
return this.data('max');
},
getOrientation() {
return this.data('orientation');
},
limitValue() {
let val = parseInt(this.val(), 10);
if (isNaN(val)) val = 0;
val = Math.max(this.getMin(), Math.min(this.getMax(), val));
this.val(val);
return val;
},
onmatch() {
const _that = this;
const val = _that.limitValue();
// setup slider controller
$("<div class='slide-controller'></div>")
.insertAfter(this)
.slider({
orientation: _that.getOrientation(),
range: 'min',
value: val,
min: _that.getMin(),
max: _that.getMax(),
slide: (event, ui) => {
_that.val(ui.value);
}
});
},
onchange() {
this
.siblings('.slide-controller')
.slider('value', this.limitValue());
}
});
});
File renamed without changes.
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment: false
53 changes: 32 additions & 21 deletions composer.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
{
"name": "tractorcow/silverstripe-sliderfield",
"description": "Simple slider field for Silverstripe",
"type": "silverstripe-module",
"keywords": ["silverstripe", "slider", "jqueryui"],
"license": "BSD-3-Clause",
"authors": [
{
"name": "Damian Mooyman",
"email": "[email protected]"
}
],
"support": {
"issues": "https://github.com/tractorcow/silverstripe-sliderfield/issues"
},
"require": {
"silverstripe/framework": "3.*",
"composer/installers": "*"
},
"extra": {
"installer-name": "sliderfield",
"name": "tractorcow/silverstripe-sliderfield",
"description": "Simple slider field for Silverstripe",
"type": "silverstripe-vendormodule",
"keywords": [
"silverstripe",
"slider",
"jqueryui"
],
"license": "BSD-3-Clause",
"authors": [
{
"name": "Damian Mooyman",
"email": "[email protected]"
}
],
"support": {
"issues": "https://github.com/tractorcow/silverstripe-sliderfield/issues"
},
"require": {
"silverstripe/vendor-plugin": "^1.0",
"silverstripe/cms": "^4.0"
},
"autoload": {
"psr-4": {
"TractorCow\\Sliderfield\\": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "4.x-dev"
}
},
"expose": [
"client/dist"
]
}
}
45 changes: 0 additions & 45 deletions javascript/SliderField.js

This file was deleted.

12 changes: 12 additions & 0 deletions license.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Copyright (c) 2016, Damian Mooyman
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading

0 comments on commit a1146c6

Please sign in to comment.