diff --git a/css/jquery.ocaddnew.css b/css/jquery.ocaddnew.css new file mode 100644 index 00000000..388bf880 --- /dev/null +++ b/css/jquery.ocaddnew.css @@ -0,0 +1,84 @@ +/** + * ownCloud - Add new jQuery plugin + * + * @author Bernhard Posselt, Thomas Tanghus + * @copyright 2012 Bernhard Posselt nukeawhale@gmail.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see . + * + */ + +.oc-addnew > li > a.oc-addnew-init:before { + content: '+'; + font-weight: bold; + font-size: 180%; + padding-right: 5px; +} + +.oc-addnew input[type=text] { + width: 120px !important; + margin-top: 15px; + height: 16px !important; +} + +.oc-addnew select { + width: 133px; + margin-top: 1px !important; + height: 30px; + background-color: #eee; +} + +.oc-addnew input, +.oc-addnew select { + margin: 0 0 5px 0; + display: inline-block; + float: left; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + border-right: 0; +} + +.oc-addnew button { + margin: 5px 0; + display: inline-block; + float: left; + border-bottom-left-radius: 0; + border-top-left-radius: 0; + height: 30px !important; +} + +.oc-addnew .action-button { + width: 30px; + background-position: center; + background-repeat: no-repeat; +} + +.oc-addnew .back-button { + border-radius: 0; + background-image: url('%webroot%/core/img/actions/delete.svg'); +} + +.oc-addnew .new-button { + border-radius: 0; + background-image: url('%webroot%/core/img/add.svg'); + border-top-right-radius: 5px; + border-bottom-right-radius: 5px; +} + +.oc-addnew .create-button { + border-radius: 0; + background-image: url('%appswebroot%/contacts/img/checkmark-gray.svg'); + border-top-right-radius: 5px; + border-bottom-right-radius: 5px; +} \ No newline at end of file diff --git a/js/jquery.ocaddnew.js b/js/jquery.ocaddnew.js new file mode 100644 index 00000000..a154db0b --- /dev/null +++ b/js/jquery.ocaddnew.js @@ -0,0 +1,135 @@ +(function($) { + $.widget('oc.addnew', { + options: { + width: 'auto', + height: 'auto', + closeOnEscape: true, + addText: 'Add' + }, + _create: function() { + //console.log('ocaddnew._create', this); + var self = this; + + this.originalCss = { + display: this.element[0].style.display, + width: this.element[0].style.width, + height: this.element[0].style.height, + }; + + this.originalTitle = this.element.attr('title') || this.element.attr('original-title'); + //console.log('ocaddnew, originalTitle', this.originalTitle); + this.options.title = this.options.title || this.originalTitle; + //console.log('ocaddnew, title', this.options.title); + this.element.hide(); + + this.$ul = $('