Skip to content

Commit

Permalink
- v2.0.3
Browse files Browse the repository at this point in the history
- Added dialog-datepicker dependency in generated resource file
- Added 'List' to label of generated list menu item
- Cleanup and comments
  • Loading branch information
joosth committed Jan 25, 2014
1 parent da96c09 commit 7bc8bf1
Show file tree
Hide file tree
Showing 9 changed files with 200 additions and 18 deletions.
4 changes: 2 additions & 2 deletions JqueryDialogGrailsPlugin.groovy
@@ -1,13 +1,13 @@
class JqueryDialogGrailsPlugin {
def version = "2.0.2"
def version = "2.0.3"
def grailsVersion = "2.0 > *"

def author = "Joost Horward"
def authorEmail = "joost@open-t.nl"
def title = "jQuery Dialog"
def description = 'Provides easy-to-maintain CRUD popup dialogs and lists with jQuery, jQuery DataTables and Twitter Bootstrap.'

def documentation = "http://www.open-t.nl/catviz/p/projects/dialog"
def documentation = "http://www.open-t.nl/projects/dialog"

def license = "AGPL3"
def organization = [ name: "Open-T", url: "http://www.open-t.nl" ]
Expand Down
43 changes: 41 additions & 2 deletions grails-app/taglib/org/open_t/dialog/DialogTagLib.groovy
Expand Up @@ -159,6 +159,15 @@ class DialogTagLib {
}
}

/**
* Provid a "simple" row that has no relation to a domain class
*
* @param label The label to show
* @param name The name that acts as the key for looking up the label and help title [name].label and [name].help)
* @param error Error message to show
* @param class CSS class to apply to the <tr> element
*/

def simplerow = { attrs,body ->
def cssClass=attrs.class ? attrs.class : ""
def error=attrs.error ? attrs.error : ""
Expand Down Expand Up @@ -871,16 +880,31 @@ class DialogTagLib {
out << """</div>"""
}

// Only needed for full-page dialogs containing an upload.
/**
* Header element for upload
* Only needed for full-page dialogs containing an upload.
*
* @param action The action to use for the JSON data source (default: fileupload)
* @param object The domain object
* @param propertyName The property of the domain object
* @param url The URL of the JSON data source (object and action are ignored)
*/
def uploadHead = { attrs ->

def action=attrs.action?:"fileupload"
def domainClass = new DefaultGrailsDomainClass( attrs.object.class )
def property=domainClass.getPropertyByName(attrs.propertyName)
def dc = new DefaultGrailsDomainClass( property.getType())
def domainPropertyName=dc.getPropertyName()
def url=attrs.url?:"${request.contextPath}/${domainPropertyName}/${action}"

def html="""
<script type="text/javascript">
\$(function() {
var uploader = new qq.FileUploader({
element: document.getElementById('file-uploader'),
// path to server-side upload script
action: cmis.baseUrl+'/cmisDocument/fileupload',
action: '${url}',
params: {
},
onComplete: function(id, fileName, responseJSON){
Expand Down Expand Up @@ -937,6 +961,8 @@ class DialogTagLib {
/**
* Displays a menu item in a dropdown menu. Should be used within a <dialog:dropdown> or <dialog:submenu> element.
* The key for the label message is menu.code.label, with code replaced by the code attribute. The key for the help message is menu.code.help, with code replaced by the code attribute.
*
* @param code The code key for lookup of messages
*/
def menuitem = { attrs,body ->
def icon=""
Expand Down Expand Up @@ -975,6 +1001,19 @@ class DialogTagLib {
out << """<li ${onclick}class="menu-item" > ${link}</li>"""
}

/**
* Select from a tree popup
* This needs a JSON data source to provide information on tree nodes to the jstree component
*
* @param action The action to use for the JSON data source (default: treeJSON)
* @param width The width of the dialog
* @param height The height of the dialog
* @param root The id of the root element to show in the tree
* @param object The domain object
* @param propertyName The property of the domain object
* @param url The URL of the JSON data source (object and action are ignored)
*/

def treeselect = { attrs, body ->
out << row ("class":attrs.class,object:attrs.object,propertyName:attrs.propertyName) {
def action=attrs.action?:"treeJSON"
Expand Down
23 changes: 23 additions & 0 deletions scripts/CreateDialogDomainClass.groovy
@@ -1,3 +1,26 @@
/*
* Grails Dialog plug-in
* Copyright 2014 Open-T B.V., and individual contributors as indicated
* by the @author tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License
* version 3 published by the Free Software Foundation.
*
* This program 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 program. If not, see http://www.gnu.org/licenses
*/

/**
* Creates a dialog domain class that includes a listconfig skeleton + imports
*/

includeTargets << grailsScript("_GrailsInit")
includeTargets << grailsScript("_GrailsCreateArtifacts")

Expand Down
23 changes: 23 additions & 0 deletions scripts/GenerateDialogController.groovy
@@ -1,3 +1,26 @@
/*
* Grails Dialog plug-in
* Copyright 2014 Open-T B.V., and individual contributors as indicated
* by the @author tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License
* version 3 published by the Free Software Foundation.
*
* This program 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 program. If not, see http://www.gnu.org/licenses
*/

/**
* Creates a dialog controller class that includes all basic CRUD actions
*/

includeTargets << grailsScript("_GrailsInit")
includeTargets << grailsScript("_GrailsCreateArtifacts")

Expand Down
24 changes: 24 additions & 0 deletions scripts/GenerateDialogMenu.groovy
@@ -1,3 +1,27 @@
/*
* Grails Dialog plug-in
* Copyright 2014 Open-T B.V., and individual contributors as indicated
* by the @author tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License
* version 3 published by the Free Software Foundation.
*
* This program 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 program. If not, see http://www.gnu.org/licenses
*/

/**
* Generates a dialog menu for all domain classes that have a listconfig
*/


includeTargets << grailsScript("_GrailsInit")
includeTargets << grailsScript("_GrailsCreateArtifacts")
includeTargets << grailsScript("_GrailsBootstrap")
Expand Down
26 changes: 25 additions & 1 deletion scripts/GenerateDialogMessages.groovy
@@ -1,3 +1,27 @@
/*
* Grails Dialog plug-in
* Copyright 2014 Open-T B.V., and individual contributors as indicated
* by the @author tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License
* version 3 published by the Free Software Foundation.
*
* This program 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 program. If not, see http://www.gnu.org/licenses
*/

/**
* Generates a messages for all domain classes
*/


includeTargets << grailsScript("_GrailsInit")
includeTargets << grailsScript("_GrailsCreateArtifacts")
includeTargets << grailsScript("_GrailsBootstrap")
Expand Down Expand Up @@ -94,7 +118,7 @@ target(generateDialogMessages: "Generates dialog messages") {

if (!labelExists("menu.${propertyControllerName}.list.label")) {
def controllerTitle=propertyControllerName[0].toUpperCase()+propertyControllerName.substring(1).replaceAll("(\\w)([A-Z])",'$1 $2')
menuText+="\nmenu.${propertyControllerName}.list.label=${controllerTitle}"
menuText+="\nmenu.${propertyControllerName}.list.label=${controllerTitle} List"
}
}
}
Expand Down
23 changes: 23 additions & 0 deletions scripts/GenerateDialogView.groovy
@@ -1,3 +1,26 @@
/*
* Grails Dialog plug-in
* Copyright 2014 Open-T B.V., and individual contributors as indicated
* by the @author tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License
* version 3 published by the Free Software Foundation.
*
* This program 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 program. If not, see http://www.gnu.org/licenses
*/

/**
* Generates dialog views for the given domain classes
*/

includeTargets << grailsScript("_GrailsInit")
includeTargets << grailsScript("_GrailsCreateArtifacts")
includeTargets << grailsScript("_GrailsBootstrap")
Expand Down
29 changes: 28 additions & 1 deletion scripts/SetupDialogApp.groovy
@@ -1,3 +1,30 @@
/*
* Grails Dialog plug-in
* Copyright 2014 Open-T B.V., and individual contributors as indicated
* by the @author tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License
* version 3 published by the Free Software Foundation.
*
* This program 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 program. If not, see http://www.gnu.org/licenses
*/

/**
* Generates setup for a dialog app:
* - [name]Resources.groovy
* - resources.groovy
* - index.gsp
* - main.gsp
*/

includeTargets << grailsScript("_GrailsInit")
includeTargets << grailsScript("_GrailsCreateArtifacts")
includeTargets << grailsScript("_GrailsBootstrap")
Expand All @@ -11,7 +38,7 @@ target(setupDialogApp: "Set up a dialog-based grails application") {
"""
modules = {
${grailsAppName} {
dependsOn 'dialog,dialog-altselect,dialog-dataTables,bootstrap-responsive-css,bootstrap-tooltip,bootstrap-popover,bootstrap-modal,dialog-bootstrap,dialog-autocomplete,dialog-last'
dependsOn 'dialog,dialog-altselect,dialog-dataTables,bootstrap-responsive-css,bootstrap-tooltip,bootstrap-popover,bootstrap-modal,dialog-bootstrap,dialog-autocomplete,dialog-datepicker,dialog-last'
}
}
"""
Expand Down
23 changes: 11 additions & 12 deletions web-app/js/dialog.fileuploader.js
@@ -1,6 +1,6 @@
/*
* CKEditor module for dialog plugin
*
*
* Grails Dialog plug-in
* Copyright 2011 Open-T B.V., and individual contributors as indicated
* by the @author tag. See the copyright.txt in the distribution for a
Expand All @@ -21,31 +21,30 @@
dialog.fileuploader = {};

dialog.fileuploader.open =function open (e,params) {

$(e.target).find('.upload').each(function (index) {
var theAction=$(this).attr("action");
var uploader = new qq.FileUploader({
// pass the dom node (ex. $(selector)[0] for jQuery users)
element: $(this)[0],
// path to server-side upload script
action: $(this).attr("action"),
params: {identifier: $(this).attr("identifier"),direct: $(this).attr("direct"),sFileName:$(this).attr("sFileName")},
onProgress:function(id, fileName, loaded, total){
$(".qq-upload-list").show();
$(".qq-upload-list").show();
},
template: '<div class="qq-uploader well">' +

template: '<div class="qq-uploader well">' +
'<div class="qq-upload-drop-area well"><span>'+dialog.messages.dropfileshere+'</span></div>' +
'<div class="qq-upload-button btn btn-primary">'+dialog.messages.upload+'</div>' +
'<ul class="qq-upload-list nav nav-list"></ul>' +
'<ul class="qq-upload-list nav nav-list"></ul>' +
'</div>',
fileTemplate: '<li>' +
'<span class="qq-upload-file"></span>' +
'<span class="qq-upload-spinner"></span>' +
'<span class="qq-upload-size"></span>' +
'<a class="qq-upload-cancel" href="#">Cancel</a>' +
'<span class="qq-upload-failed-text">Failed</span>' +
'</li>',
'</li>',
onComplete: function(id, fileName, responseJSON){
var upload=fileName+"|"+responseJSON.path+"|"+responseJSON.mimetype+"|"+responseJSON.identifier+"|"+responseJSON.fileCategory+"|"+responseJSON.direct+"|"+responseJSON.sFileName;
// Preventing the submit-time copy is a bad idea for new entries
Expand All @@ -55,12 +54,12 @@ dialog.fileuploader.open =function open (e,params) {
$(".dialog-events").trigger("dialog-refresh",{dc:"ALL",id:id});
//$(".qq-upload-list").hide();
}
});
});
});

return false

}
return false;

};



Expand Down

0 comments on commit 7bc8bf1

Please sign in to comment.