Skip to content

Commit

Permalink
add e-single, add minified css, add MIT license, Fix radiolist, new e…
Browse files Browse the repository at this point in the history
…ditables match the waiting state of the form, Allow passing min/maxYear to combodate
  • Loading branch information
Mitch Thompson committed Feb 16, 2016
1 parent 6e3edc2 commit 9025257
Show file tree
Hide file tree
Showing 16 changed files with 338 additions and 75 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@
dev.html
jsdoc.json
/.idea
node_modules
.tmp
.sass-cache
bower_components
npm-debug.log
6 changes: 4 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports = function(grunt) {
grunt.config('uglify', {
options: {
banner: banner
},
},
dist: {
src: ['<%= concat.dist.dest %>'],
dest: 'dist/js/xeditable.min.js'
Expand Down Expand Up @@ -128,14 +128,16 @@ module.exports = function(grunt) {
return text;
};



var jadeData = {
fs: require('fs'),
md: marked,
version: '<%= pkg.version %>',
size: Math.floor(fs.statSync('dist/js/xeditable.min.js').size / 1024),
structure: require('./docs/js/structure.js'),
jsdoc: '<%= jsdocdata %>'
};

grunt.loadNpmTasks('grunt-contrib-jade');
grunt.config('jade', {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-xeditable",
"version": "0.1.9",
"version": "0.1.10",
"description": "Edit in place for AngularJS",
"author": "https://github.com/vitalets",
"license": "MIT",
Expand Down
121 changes: 115 additions & 6 deletions dist/css/xeditable.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,116 @@
/*!
angular-xeditable - 0.1.9
Edit-in-place for angular.js
Build date: 2015-03-26
*/

.editable-wrap{display:inline-block;white-space:nowrap;margin:0}.editable-wrap .editable-controls,.editable-wrap .editable-error{margin-bottom:0}.editable-wrap .editable-controls>input,.editable-wrap .editable-controls>select,.editable-wrap .editable-controls>textarea{margin-bottom:0}.editable-wrap .editable-input{display:inline-block}.editable-buttons{display:inline-block;vertical-align:top}.editable-buttons button{margin-left:5px}.editable-input.editable-has-buttons{width:auto}.editable-bstime .editable-input input[type=text]{width:46px}.editable-bstime .well-small{margin-bottom:0;padding:10px}.editable-range output{display:inline-block;min-width:30px;vertical-align:top;text-align:center}.editable-color input[type=color]{width:50px}.editable-checkbox label span,.editable-checklist label span,.editable-radiolist label span{margin-left:7px;margin-right:10px}.editable-hide{display:none!important}.editable-click,a.editable-click{text-decoration:none;color:#428bca;border-bottom:dashed 1px #428bca}.editable-click:hover,a.editable-click:hover{text-decoration:none;color:#2a6496;border-bottom-color:#2a6496}.editable-empty,.editable-empty:hover,.editable-empty:focus,a.editable-empty,a.editable-empty:hover,a.editable-empty:focus{font-style:italic;color:#D14;text-decoration:none}
/* ==== editable-form ==== */

/* class for single editable element */
.editable-wrap {
display: inline-block;
white-space: nowrap;
margin: 0;
}

/* remove bottom-margin for bootstrap */
.editable-wrap .editable-controls,
.editable-wrap .editable-error {
margin-bottom: 0;
}

/* remove bottom-margin of inputs */
.editable-wrap .editable-controls > input,
.editable-wrap .editable-controls > select,
.editable-wrap .editable-controls > textarea {
margin-bottom: 0;
}

/* keep buttons on the same line */
.editable-wrap .editable-input {
display: inline-block;
}

.editable-buttons {
display: inline-block;
vertical-align: top;
}

.editable-buttons button {
margin-left: 5px;
}

/* in bootstrap width: 100% => buttons go outside the box */
.editable-input.editable-has-buttons {
width: auto;
}

/* ==== editable-bstime ==== */

/* workaround for bootstrap that sets width: 100% and inputs become too wide */
.editable-bstime .editable-input input[type="text"] {
width: 46px;
}

/* less padding for .well */
.editable-bstime .well-small {
margin-bottom: 0;
padding: 10px;
}

/* ==== editable-range ==== */

.editable-range output {
display: inline-block;
min-width: 30px;
vertical-align: top;
text-align: center;
}

/* ==== editable-color ==== */

.editable-color input[type="color"] {
width: 50px;
}


/* ==== editable-checkbox ==== */
/* ==== editable-checklist ==== */
/* ==== editable-radiolist ==== */

.editable-checkbox label span,
.editable-checklist label span,
.editable-radiolist label span {
margin-left: 7px;
margin-right: 10px;
}

/* ==== element ==== */

/* hiding element */
.editable-hide {
display: none !important;
}

.editable-click,
a.editable-click {
text-decoration: none;
color: #428bca;
border-bottom: dashed 1px #428bca;
}

.editable-click:hover,
a.editable-click:hover {
text-decoration: none;
color: #2a6496;
border-bottom-color: #2a6496;
}

/* editable-empty */
.editable-empty,
.editable-empty:hover,
.editable-empty:focus,
a.editable-empty,
a.editable-empty:hover,
a.editable-empty:focus {
font-style: italic;
color: #DD1144;
text-decoration: none;
}


7 changes: 7 additions & 0 deletions dist/css/xeditable.min.css

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

34 changes: 26 additions & 8 deletions dist/js/xeditable.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
angular-xeditable - 0.1.9
angular-xeditable - 0.1.10
Edit-in-place for angular.js
Build date: 2015-03-26
Build date: 2016-02-16
*/
/**
* Angular-xeditable module
Expand Down Expand Up @@ -32,7 +32,7 @@ angular.module('xeditable', [])
*/
icon_set: 'default',
/**
* Whether to show buttons for single editable element.
* Whether to show buttons for single editalbe element.
* Possible values `right` (default), `no`.
*
* @var {string} buttons
Expand Down Expand Up @@ -228,16 +228,28 @@ angular.module('xeditable').directive('editableCombodate', ['editableDirectiveFa
inputTpl: '<input type="text">',
render: function() {
this.parent.render.call(this);
var combodate = editableCombodate.getInstance(this.inputEl, {value: new Date(this.scope.$data)});

var options = {
value: new Date(this.scope.$data)
};
var self = this;
angular.forEach(["format", "template", "minYear", "maxYear", "yearDescending", "minuteStep", "secondStep", "firstItem", "errorClass", "customClass", "roundTime", "smartDays"], function(name) {

var attrName = "e" + name.charAt(0).toUpperCase() + name.slice(1);
if (attrName in self.attrs) {
options[name] = self.attrs[attrName];
}
});

var combodate = editableCombodate.getInstance(this.inputEl, options);
combodate.$widget.find('select').bind('change', function(e) {
self.scope.$data = (new Date(combodate.getValue())).toISOString();
});
}
});
}
]);

/*
Input types: text|email|tel|number|url|search|color|date|datetime|time|month|week
*/
Expand Down Expand Up @@ -288,7 +300,7 @@ angular.module('xeditable').directive('editableRadiolist', [
this.parent.render.call(this);
var parsed = editableNgOptionsParser(this.attrs.eNgOptions);
var html = '<label ng-repeat="'+parsed.ngRepeat+'">'+
'<input type="radio" ng-disabled="' + this.attrs.eNgDisabled + '" ng-model="$parent.$data" ng-value="'+parsed.locals.valueFn+'">'+
'<input type="radio" ng-disabled="' + this.attrs.eNgDisabled + '" ng-model="$parent.$data" value="{{'+parsed.locals.valueFn+'}}">'+
'<span ng-bind="'+parsed.locals.displayFn+'"></span></label>';

this.inputEl.removeAttr('ng-model');
Expand Down Expand Up @@ -632,7 +644,7 @@ angular.module('xeditable').factory('editableController',

/*
Originally render() was inside init() method, but some directives polluting editorEl,
so it is broken on second opening.
so it is broken on second openning.
Cloning is not a solution as jqLite can not clone with event handler's.
*/
self.render();
Expand Down Expand Up @@ -857,8 +869,8 @@ function($parse, $compile, editableThemes, $rootScope, $document, editableContro
// element wrapped by form
if(ctrl[1]) {
eFormCtrl = ctrl[1];
hasForm = true;
} else if(attrs.eForm) { // element not wrapped by <form>, but we have `e-form` attr
hasForm = attrs.eSingle === undefined;
} else if(attrs.eForm) { // element not wrapped by <form>, but we hane `e-form` attr
var getter = $parse(attrs.eForm)(scope);
if(getter) { // form exists in scope (above), e.g. editable column
eFormCtrl = getter;
Expand Down Expand Up @@ -1040,6 +1052,11 @@ angular.module('xeditable').factory('editableFormController',
}
});

$rootScope.$on('closeEdit', function() {
for(var i=0; i < shown.length; i++) {
shown[i].$hide();
}
});

var base = {
$addEditable: function(editable) {
Expand All @@ -1058,6 +1075,7 @@ angular.module('xeditable').factory('editableFormController',
if (this.$visible) {
editable.catchError(editable.show());
}
editable.catchError(editable.setWaiting(this.$waiting));
},

$removeEditable: function(editable) {
Expand Down
6 changes: 3 additions & 3 deletions dist/js/xeditable.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 9025257

Please sign in to comment.