Commit af3b6463 by aagusti

perbaikan fungsi add

1 parent 8c9d0f6d
*.DS_Store
*.sublime-project
*.sublime-workspace
node_modules/*
*.log
.idea/
{
"debug": true,
"devel": true,
"browser": true,
"asi": true,
"unused": true,
"eqnull": true
}
\ No newline at end of file
language: node_js
node_js:
- 8
before_script:
- npm install -g grunt-cli
before_install: npm install -g npm@latest
install: npm ci
# Contributing
Want to help contribute something to the project? Awesome! :smile:
Please take a moment to review this doc to make contributions easy and effective for everyone.
If there’s anything you’d like to discuss before diving in, you can find us on Gitter.
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/amsul/pickadate.js)
<a name="bugs"></a>
## Bug reports
If you believe you’ve found a bug within the repository code:
- Search the existing issues to avoid duplicates and to check if it has already been solved.
- Make sure you’re using the latest build.
- Isolate the problem and create a [reduced test case](http://css-tricks.com/6263-reduced-test-cases/) - preferably supported with a live example.
- Try to be as detailed as possible in the report (OS, browser, expected outcome vs actual outcome, etc).
- Please **do not** use the issue tracker for personal support requests. Instead try [Stack Overflow](http://stackoverflow.com/questions/tagged/pickadate) or the likes with a `pickadate` tag.
<a name="pull-requests"></a>
## Pull requests
If you’re submitting a pull request, please respect the coding standards used (indentations, comments, semi-colons, etc) as per the **Golden Rule**:
> All code in any code base should look like a single person typed it, no matter how many people contributed.
A few other things to keep in mind:
- Make sure the changes are suitable within the scope of this project.
- Discuss any significant features before endeavoring into developing them. I’d hate to have anyone spend effort on something only for me to not merge it into the main project.
- Include the relevant test coverage if any JavaScript files are involved.
- Compile the project using `grunt build --verbose` to make sure everything passes with a green flag.
- Use the Semantic Versioning guide, as mentioned in the [readme file](https://github.com/amsul/pickadate.js/#readme), in the case that a version bump is due.
#### All pull requests should be submitted to the `master` branch.
<a name="features"></a>
## Feature requests
Feature requests are welcome. But take a moment to find out whether your idea fits within the scope and aims of this project. It’s up to *you* to make a strong case to the merits of this feature. Please provide as much detail and context as possible.
/*!
* This Gruntfile is used to build the project files.
*/
/*jshint
node: true
*/
module.exports = function( grunt ) {
// Read the package manifest.
var packageJSON = grunt.file.readJSON( 'package.json' )
// Load the NPM tasks.
grunt.loadNpmTasks( 'grunt-contrib-watch' )
grunt.loadNpmTasks( 'grunt-contrib-jshint' )
grunt.loadNpmTasks( 'grunt-contrib-qunit' )
grunt.loadNpmTasks( 'grunt-contrib-less' )
grunt.loadNpmTasks( 'grunt-contrib-cssmin' )
grunt.loadNpmTasks( 'grunt-contrib-uglify' )
grunt.loadNpmTasks( 'grunt-autoprefixer' )
// Setup the initial configurations.
grunt.initConfig({
// Add the package data.
pkg: packageJSON,
// Set up the directories.
dirs: {
tests: 'tests',
lib: {
src: 'lib',
min: 'lib/compressed'
},
themes: {
src: 'lib/themes-source',
dest: 'lib/themes',
min: 'lib/compressed/themes'
},
translations: {
src: 'lib/translations',
min: 'lib/compressed/translations'
},
},
// Compile LESS into CSS.
less: {
options: {
style: 'expanded'
},
themes: {
files: {
'<%= dirs.themes.dest %>/default.css': [ '<%= dirs.themes.src %>/base.less', '<%= dirs.themes.src %>/default.less' ],
'<%= dirs.themes.dest %>/classic.css': [ '<%= dirs.themes.src %>/base.less', '<%= dirs.themes.src %>/classic.less' ],
'<%= dirs.themes.dest %>/default.date.css': [ '<%= dirs.themes.src %>/base.date.less', '<%= dirs.themes.src %>/default.date.less' ],
'<%= dirs.themes.dest %>/default.time.css': [ '<%= dirs.themes.src %>/base.time.less', '<%= dirs.themes.src %>/default.time.less' ],
'<%= dirs.themes.dest %>/classic.date.css': [ '<%= dirs.themes.src %>/base.date.less', '<%= dirs.themes.src %>/classic.date.less' ],
'<%= dirs.themes.dest %>/classic.time.css': [ '<%= dirs.themes.src %>/base.time.less', '<%= dirs.themes.src %>/classic.time.less' ],
'<%= dirs.themes.dest %>/rtl.css': [ '<%= dirs.themes.src %>/rtl.less' ]
}
}
},
// Lint the files.
jshint: {
options: {
jshintrc: true
},
gruntfile: 'Gruntfile.js',
lib: [
'<%= dirs.tests %>/units/*.js',
'<%= dirs.lib.src %>/**/*.js',
// Ignore the legacy and minified files.
'!<%= dirs.lib.src %>/legacy.js',
'!<%= dirs.lib.src %>/compressed/**/*.js'
]
},
// Minify all the things!
uglify: {
options: {
preserveComments: 'some'
},
lib: {
files: [
{
expand : true,
cwd : '<%= dirs.lib.src %>',
src : [ '**/*.js', '!compressed/**/*.js' ],
dest : '<%= dirs.lib.min %>'
}
]
}
},
cssmin: {
lib: {
expand: true,
cwd: '<%= dirs.themes.dest %>',
src: [ '**/*.css', '!compressed/**/*.css' ],
dest: '<%= dirs.themes.min %>'
}
},
// Prefix the styles.
autoprefixer: {
options: {
browsers: [ '> 5%', 'last 2 versions', 'ie 8', 'ie 9' ]
},
themes: {
src: '<%= dirs.themes.dest %>/**/*.css'
},
},
// Unit test the files.
qunit: {
lib: [ '<%= dirs.tests %>/units/all.htm' ]
},
// Watch the project files.
watch: {
develop: {
files: [
'<%= dirs.themes.src %>/**/*.less'
],
tasks: [ 'develop-once' ]
},
}
}) //grunt.initConfig
// Register the tasks.
grunt.registerTask( 'default', [ 'develop' ] )
grunt.registerTask( 'develop', [ 'develop-once', 'watch:develop' ] )
grunt.registerTask( 'develop-once', [ 'less:themes', 'autoprefixer:themes' ] )
grunt.registerTask( 'package', [ 'develop-once', 'uglify', 'cssmin' ] )
grunt.registerTask( 'test', [ 'jshint', 'qunit' ] )
} //module.exports
Copyright 2014 Amsul, http://amsul.ca
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
# pickadate [![Build status: master](https://travis-ci.org/amsul/pickadate.js.svg?branch=master)](https://travis-ci.org/amsul/pickadate.js) [![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/pickadate/badge?style=rounded)](https://www.jsdelivr.com/package/npm/pickadate)
The mobile-friendly, responsive, and lightweight jQuery date & time input picker.
[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/pickadate)
#### To get started, check out the:
[Homepage](http://amsul.ca/pickadate.js) - [Date picker](http://amsul.ca/pickadate.js/date) - [Time picker](http://amsul.ca/pickadate.js/time) - [API](http://amsul.ca/pickadate.js/api)
#### To get it:
[Download the latest stable build](https://github.com/amsul/pickadate.js/archive/master.zip)
*or*
`git clone git://github.com/amsul/pickadate.js.git`
*or*
`bower install pickadate`
<br>
## Library files
The `lib` folder includes the library files with a `compressed` folder containing the minified counter-parts. These files are minified using [Grunt](#building-with-grunt).
### Pickers
There are three picker files:
* `picker.js` The core file (required before any other picker)
* `picker.date.js` The date picker
* `picker.time.js` The time picker
_To support old browsers, namely IE8, **also include** the `legacy.js` file._
### Themes
All themes are [generated using LESS](#less-styling) and compiled from the `lib/themes-source` folder into the `lib/themes` folder.
There are two themes:
* `default.css` The default modal-style theme
* `classic.css` The classic dropdown-style theme
Based on the theme, pick the relevant picker styles:
* `default.date.css` and `default.time.css` when using the default theme
* `classic.date.css` and `classic.time.css` when using the classic theme
__**__ For languages with text flowing from right-to-left, also include the `rtl.css` stylesheet.
### Translations
The translations live in the `lib/translations` folder. There are currently [43 language translations](https://github.com/amsul/pickadate.js/tree/master/lib/translations) included.
<br>
## Building with Grunt
[Grunt](http://gruntjs.com/) `~0.4.5` is used to build the project files. To get started, clone the project and then run:
- `npm install` to get the required node modules.
- `grunt test --verbose` to confirm you have all the dependencies.
Type out `grunt --help` to see a list of all the tasks available. The generally used tasks are:
- `grunt develop` compiles the LESS files and watches for any source changes.
- `grunt package` compiles and then minifies the source files.
- `grunt test` tests the entire package.
<br>
<a name="less-styling"></a>
## Styling with LESS
The picker themes are built using [LESS](http://lesscss.org/) with Grunt. To customize the CSS output, read the `_variables.less` file in the `lib/themes-source` folder. You can specify:
- colors for the theme,
- sizes for the picker,
- media-query breakpoints,
- and a whole bunch of other stuff.
Make sure to run the `grunt develop` task before making any changes to compile it into CSS.
<br>
## Bugs
Before opening a new issue, please search the existing [Issues](https://github.com/amsul/pickadate.js/issues) for anything similar – there might already be an answer to your problem. You might also wanna check out the [Contributing](https://github.com/amsul/pickadate.js/blob/master/CONTRIBUTING.md) guide.
<br>
## Contributing
Before contributing any code to the project, please take a look at the [Contributing](https://github.com/amsul/pickadate.js/blob/master/CONTRIBUTING.md) guide.
If there’s anything you’d like to discuss, we like to hang out on Spectrum.
[![Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/pickadate)
<br>
## Support
If you find this library useful and would like to see further development, consider [supporting it](http://selz.co/1g80kCZ).
<br><br>
---
© 2014 [Amsul](http://twitter.com/amsul_)
Licensed under [MIT](http://amsul.ca/MIT)
{
"name": "pickadate",
"description": "The mobile-friendly, responsive, and lightweight jQuery date & time input picker.",
"main": [
"lib/picker.js",
"lib/picker.date.js",
"lib/picker.time.js",
"lib/themes/default.css",
"lib/themes/default.date.css",
"lib/themes/default.time.css"
],
"license": "MIT",
"ignore": [
"*.md",
"*.htm",
"_docs",
"demo"
],
"keywords": [
"date",
"time",
"picker",
"input",
"responsive"
],
"authors": {
"name": "Amsul",
"email": "reach@amsul.ca",
"homepage": "http://amsul.ca"
},
"homepage": "http://amsul.ca/pickadate.js",
"repository": {
"type": "git",
"url": "git://github.com/amsul/pickadate.js.git"
},
"dependencies": {
"jquery": ">=1.7"
},
"devDependencies": {
"grunt": "^0.4.5",
"grunt-autoprefixer": "^1.0.1",
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-cssmin": "^0.9.0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-less": "^0.11.4",
"grunt-contrib-qunit": "^0.4.0",
"grunt-contrib-uglify": "^0.4.1",
"grunt-contrib-watch": "^0.6.1",
"phantomjs": "^1.9.7-5",
"zlib-browserify": "0.0.3"
}
}
\ No newline at end of file
{
"name": "pickadate",
"version": "3.6.4",
"title": "pickadate.js",
"description": "The mobile-friendly, responsive, and lightweight jQuery date & time input picker.",
"keywords": [
"date",
"time",
"picker",
"input",
"responsive"
],
"homepage": "http://amsul.ca/pickadate.js",
"bugs": "https://github.com/amsul/pickadate.js/issues",
"license": "MIT",
"author": {
"name": "Amsul",
"email": "reach@amsul.ca",
"url": "http://amsul.ca"
},
"files": [
"lib",
"tests",
"README.md",
"Gruntfile.js"
],
"repository": {
"type": "git",
"url": "https://github.com/amsul/pickadate.js.git"
},
"scripts": {
"prebump": "npm test",
"bump": "node ./version-bump.js",
"postbump": "npx grunt package && node ./version-commit.js",
"push": "git push && git push origin --tags && npm publish",
"test": "npx grunt test --verbose"
},
"dependencies": {
"jquery": ">=1.7"
},
"devDependencies": {
"commander": "^2.8.0",
"glob": "^5.0.5",
"grunt": "^0.4.5",
"grunt-autoprefixer": "^3.0.0",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-cssmin": "^0.12.2",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-less": "^1.0.1",
"grunt-contrib-qunit": "^2.0.0",
"grunt-contrib-uglify": "^0.9.1",
"grunt-contrib-watch": "^0.6.1",
"qunitjs": "1.x",
"semver": "^4.3.3",
"shelljs": "^0.4.0",
"zlib-browserify": "0.0.3"
}
}
\ No newline at end of file
<!doctype html>
<html>
<meta charset="utf-8">
<meta name="author" content="Amsul - http://amsul.ca">
<meta name="viewport" content="width=device-width,user-scalable=no">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<title>Pickadate.js</title>
<link rel="stylesheet" href="../../lib/themes/default.css">
<link rel="stylesheet" href="../../lib/themes/default.date.css">
<!--[if lt IE 9]>
<script>document.createElement('section')</script>
<style type="text/css">
.holder {
position: relative;
z-index: 10000;
}
.datepicker {
display: block;
}
</style>
<![endif]-->
<body>
<section class="section">
<form>
<fieldset>
<h3><label for="input_01">Pick a date. Go ahead...</label></h3>
<input
id="input_01"
class="datepicker"
name="date"
type="text"
autofocus
value="14 August, 2014"
data-value="2014-08-08">
<br><br><br><br><br>
<!-- <button type="button">Disable all dates</button>
<input class="button" type="submit" value="open"> -->
</fieldset>
</form>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<div id="container"></div>
</section>
<script src="../../node_modules/jquery/dist/jquery.js"></script>
<script src="../../lib/picker.js"></script>
<script src="../../lib/picker.date.js"></script>
<script src="../../lib/legacy.js"></script>
<script type="text/javascript">
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10) {
dd='0'+dd;
}
if(mm<10) {
mm='0'+mm;
}
today = dd+'/'+mm+'/'+yyyy;
var $input = $( '.datepicker' ).pickadate({
formatSubmit: 'yyyy/mm/dd',
// min: [2015, 7, 14],
container: '#container',
// editable: true,
closeOnSelect: false,
closeOnClear: false,
})
var picker = $input.pickadate('picker')
// picker.set('select', '14 October, 2014')
// picker.open()
// $('button').on('click', function() {
// picker.set('disable', true);
// });
</script>
</body>
</html>
<!doctype html>
<html>
<meta charset="utf-8">
<meta name="author" content="Amsul - http://amsul.ca">
<meta name="viewport" content="width=device-width">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<title>Pickadate.js</title>
<link rel="stylesheet" href="../../lib/themes/default.css">
<link rel="stylesheet" href="../../lib/themes/default.time.css">
<!--[if lt IE 9]>
<script>document.createElement('section')</script>
<style type="text/css">
.holder {
position: relative;
z-index: 10000;
}
.datepicker {
display: block;
}
</style>
<![endif]-->
<body>
<section class="section">
<form>
<fieldset>
<h3><label for="input_01">Pick a time. Go ahead...</label></h3>
<input
id="input_from"
class="datepicker"
type="time"
name="time"
autofocus>
<!-- valuee="2:30 AM"
data-value="0:00" -->
</fieldset>
</form>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</section>
<script src="../../node_modules/jquery/dist/jquery.js"></script>
<script src="../../lib/picker.js"></script>
<script src="../../lib/picker.time.js"></script>
<script src="../../lib/legacy.js"></script>
<script type="text/javascript">
var $input = $( '.datepicker' ).pickatime({
})
var picker = $input.pickatime('picker')
picker.open()
</script>
</body>
</html>
<!doctype html>
<meta charset="utf-8">
<title>pickadate.js &#8226; QUnit testing</title>
<link rel="stylesheet" href="../../node_modules/qunitjs/qunit/qunit.css">
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="../../node_modules/jquery/dist/jquery.js"></script>
<script src="../../lib/picker.js"></script>
<script src="../../lib/picker.date.js"></script>
<script src="../../lib/picker.time.js"></script>
<script src="../../node_modules/qunitjs/qunit/qunit.js"></script>
<script src="base.js"></script>
<script src="date.js"></script>
<script src="time.js"></script>
</body>
\ No newline at end of file
/*jshint node: true*/
var program = require('commander')
var semver = require('semver')
var grunt = require('grunt')
var glob = require('glob').sync
program
.option('-p, --patch', 'set the version as the next patch')
.option('-m, --minor', 'set the version as the next minor')
.option('-M, --major', 'set the version as the next major')
.parse(process.argv)
if (program.patch) {
bumpVersion('patch')
return
}
if (program.minor) {
bumpVersion('minor')
return
}
if (program.major) {
bumpVersion('major')
return
}
grunt.fail.fatal('No release type specified')
return
function bumpVersion(release) {
grunt.log.writeln('Bumping package version by a ' + release)
var version = readPackageVersion()
grunt.log.writeln('Current package version: ' + version)
version = semver.inc(version, release)
grunt.log.writeln('Updated package version: ' + version)
writePackageVersion(version)
grunt.log.writeln('Done updating the package version')
updateLibraryFiles(version)
grunt.log.writeln('Done updating the library files')
}
function readPackageVersion() {
var pkg = require('./package')
return pkg.version
}
function writePackageVersion(version) {
var pkg = require('./package')
pkg.version = version
grunt.file.write('./package.json', JSON.stringify(pkg, null, ' '))
}
function updateLibraryFiles(version) {
var versionRegex = /^(\s*\/\*![^\/]+?v)(\d+\.\d+\.\d+)(([^\n]+?)(\d+\/\d+\/\d+))?/
var today = grunt.template.today('yyyy/mm/dd')
var files = glob('lib/*.js')
files.forEach(updateLibraryFile)
function updateLibraryFile(filePath) {
var content = grunt.file.read(filePath)
if (versionRegex.test(content)) {
content = content.split(versionRegex)
content = content[1] + version + (content[4] || '') + (content[5] ? today : '') + (content[6] || '')
}
grunt.file.write(filePath, content)
}
}
\ No newline at end of file
/*jshint node: true*/
var grunt = require('grunt')
var exec = require('shelljs').exec
var pkg = require('./package')
var isSuccessful = commitAndTag(pkg.version)
if (!isSuccessful) {
grunt.fail.fatal('Unable to commit and tag version')
}
return
function commitAndTag(version) {
var code = exec([
'git add .',
'git commit -m "Release v' + version + '"',
'git tag ' + version,
].join(' && ')).code
return !code
}
\ No newline at end of file
......@@ -31,6 +31,7 @@ from ...detable import DeTable
log = logging.getLogger(__name__)
class UploadSchema(colander.Schema):
upload = colander.SchemaNode(
FileData(),
......@@ -184,7 +185,7 @@ class BaseView(object):
if "bindings" in kwargs and kwargs["bindings"]:
bindings = kwargs["bindings"]
else:
bindings = self.bindings
bindings = self.get_bindings()
form_params = {}
# form_params["after_bind"] = after_bind
if "validator" in kwargs and kwargs["validator"]:
......@@ -383,10 +384,10 @@ class BaseView(object):
else:
return self.next_act()
def view_add(self):
bindings = self.get_bindings()
form = self.get_form(self.add_schema, bindings=bindings)
table = self.get_item_table()
def view_add(self, **kwargs):
# bindings = self.get_bindings()
form = self.get_form(self.add_schema, **kwargs)
table = self.get_item_table(**kwargs)
resources = form.get_widget_resources()
if self.req.POST:
if 'save' in self.req.POST:
......@@ -477,7 +478,7 @@ class BaseView(object):
d[f] = d[f].strip()
return d
def get_item_table(self, row=None):
def get_item_table(self, row=None, **kwargs):
return
def before_edit(self, form):
......
......@@ -3,9 +3,11 @@ import logging
from deform.widget import (
SchemaType,
DateInputWidget as DeformDateInputWidget)
DateInputWidget as DeformDateInputWidget,
default_resources, ResourceRegistry, default_resource_registry)
from colander import null, Invalid
_logging = logging.getLogger(__name__)
class _FieldStorage(SchemaType):
def deserialize(self, node, cstruct):
if cstruct in (null, None, '', b''):
......@@ -16,52 +18,128 @@ class _FieldStorage(SchemaType):
return cstruct
class DateInputWidget(DeformDateInputWidget):
"""
Renders a date picker widget.
# class DateInputWidget(DeformDateInputWidget):
# """
# Renders a date picker widget.
#
# The default rendering is as a native HTML5 date input widget,
# falling back to pickadate (https://github.com/amsul/pickadate.js.)
#
# Most useful when the schema node is a ``colander.Date`` object.
#
# **Attributes/Arguments**
#
# options
# Dictionary of options for configuring the widget (eg: date format)
#
# template
# The template name used to render the widget. Default:
# ``dateinput``.
#
# readonly_template
# The template name used to render the widget in read-only mode.
# Default: ``readonly/textinput``.
# """
# requirements = {
# "js": (
# "deform:static/scripts/modernizr.custom.input-types-and-atts.js",
# "static/pickadate/lib/picker.js",
# "static/pickadate/lib/picker.date.js",
# "static/pickadate/lib/picker.time.js",
# "static/pickadate/lib/legacy.js",
# ),
# "css": (
# "static/pickadate/lib/themes/default.css",
# "static/pickadate/lib/themes/default.date.css",
# "static/pickadate/lib/themes/default.time.css",
# ),
# }
# default_options = (
# ("format", "yyyy-mm-dd"),
# ("selectMonths", True),
# ("selectYears", True),
# ("formatSubmit", "yyyy-mm-dd"),
# )
# def serialize(self, field, cstruct, **kw):
# if cstruct in (null, None):
# cstruct = ""
# readonly = kw.get("readonly", self.readonly)
# template = readonly and self.readonly_template or self.template
# options = dict(
# kw.get("options") or self.options or self.default_options
# )
# kw.setdefault("options_json", json.dumps(options))
# values = self.get_template_values(field, cstruct, kw)
# return field.renderer(template, **values)
#
# def deserialize(self, field, pstruct):
# logging.debug(f"widget: {field} {pstruct}")
# if pstruct in ("", null):
# return null
# try:
# validated = self._pstruct_schema.deserialize(pstruct)
# except Invalid as exc:
# raise Invalid(field.schema, "Invalid pstruct: %s" % exc)
# return validated["date_submit"] or validated["date"]
The default rendering is as a native HTML5 date input widget,
falling back to pickadate (https://github.com/amsul/pickadate.js.)
Most useful when the schema node is a ``colander.Date`` object.
**Attributes/Arguments**
options
Dictionary of options for configuring the widget (eg: date format)
template
The template name used to render the widget. Default:
``dateinput``.
readonly_template
The template name used to render the widget in read-only mode.
Default: ``readonly/textinput``.
"""
default_options = (
("format", "yyyy-mm-dd"),
("selectMonths", True),
("selectYears", True),
("formatSubmit", "yyyy-mm-dd"),
)
def serialize(self, field, cstruct, **kw):
if cstruct in (null, None):
cstruct = ""
readonly = kw.get("readonly", self.readonly)
template = readonly and self.readonly_template or self.template
options = dict(
kw.get("options") or self.options or self.default_options
)
kw.setdefault("options_json", json.dumps(options))
values = self.get_template_values(field, cstruct, kw)
return field.renderer(template, **values)
def deserialize(self, field, pstruct):
logging.debug(f"widget: {field} {pstruct}")
if pstruct in ("", null):
return null
try:
validated = self._pstruct_schema.deserialize(pstruct)
except Invalid as exc:
raise Invalid(field.schema, "Invalid pstruct: %s" % exc)
return validated["date_submit"] or validated["date"]
# default_resources["pickadate"] = \
# {
# None: {
# "js": (
# "static/pickadate/lib/picker.js",
# "static/pickadate/lib/picker.date.js",
# "static/pickadate/lib/picker.time.js",
# "static/pickadate/lib/legacy.js",
# ),
# "css": (
# "static/pickadate/lib/themes/default.css",
# "static/pickadate/lib/themes/default.date.css",
# "static/pickadate/lib/themes/default.time.css",
# ),
# }
# }
# default_resources = {
# "jquery.form": {None: {"js": "deform:static/scripts/jquery.form-3.09.js"}},
# "jquery.maskedinput": {
# None: {"js": "deform:static/scripts/jquery.maskedinput-1.3.1.min.js"}
# },
# "jquery.maskMoney": {
# None: {"js": "deform:static/scripts/jquery.maskMoney-3.1.1.min.js"}
# },
# "deform": {
# None: {
# "js": (
# "deform:static/scripts/jquery.form-3.09.js",
# "deform:static/scripts/deform.js",
# )
# }
# },
# "typeahead": {
# None: {
# "js": "deform:static/scripts/typeahead.min.js",
# "css": "deform:static/css/typeahead.css",
# }
# },
# "modernizr": {
# None: {
# "js": "deform:static/scripts/modernizr.custom.input-types-and-atts.js" # noQA
# }
# },
# "pickadate": {
# None: {
# "js": (
# "static/pickadate/lib/picker.js",
# "static/pickadate/lib/picker.date.js",
# "static/pickadate/lib/picker.time.js",
# "static/pickadate/lib/legacy.js",
# ),
# "css": (
# "static/pickadate/lib/themes/default.css",
# "static/pickadate/lib/themes/default.date.css",
# "static/pickadate/lib/themes/default.time.css",
# ),
# }
# },
# }
#
# default_resource_registry = ResourceRegistry()
......@@ -68,8 +68,12 @@
return 'Archived';
}
for (let co in ${tableid}Columns) {
if (${tableid}Columns[co].checkbox === true) {
function render_checklist(value) {
return '<input type="checkbox" checked="'+{value}+'"></input>';
}
if (${tableid}Columns[co].checkbox === true) {
${tableid}Columns[co].className = "text-center";
${tableid}Columns[co].width = "30pt";
${tableid}Columns[co].render = function (val) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!