In a project, I recently replaced a simple form-based file upload with SWFUpload. When SWFUpload returns a success, I generate a form to add tags to the uploaded asset.
I'd like to be able to test inputting data into the tags textbox, but to do that I (think I) need to fake out SWFUpload.
Has anyone done this in the past? I haven't been able to find anything via google, and there doesn't seem to be anything in the cucumber docs re: testing Flash.
I dont think you need to fake flash at all, because all swfupload is doing for you is simulating a simple http post.
If you do a manual http post to the same action/controller that your swfupload is posting to and make sure the file field of your post is named the same as the swf parameter which swfupload passes (params[:Filedata]) you should get the same effect.
Also to answer Swanand's comment above you need to hack CGI::Session. Try http://blog.isshen.com/2008/10/5/making-swfupload-and-rails-2-1-sessions-work-together
I recently stumbled upon this plugin which may be able to help you with what yo need to do. You can read more here.
Related
I have an ingredient form and I want the user to type only the name and then the carb, protein and fat get automatically loaded. I know I need an ajax request but I don't know the path to learn how to accomplish this.
Can anyone gives an example or tell me where I can find it?
Learn Jquery too. Jquery is a widely used Javascript library and you will find a lot of help too.
Coming back to the question, $ajax method will be used to send an ajax request from your .js file. You will find a lot of documentation on it.
If you want to send an ajax request using rails helpers and views use the
remote : true
option. it will process your request as a XmlHttpRequest one. You can check the type of request by naigating to your browsers console and see the type of request. In case of Ajax request it will be XmlHttpRequest type.
This is not a thorough answer since you will find a lot of documentation on internet. But just to get you started.
I'm writing my first single page application and have a requirement by where the user is going to need to upload documents and/or images.
Is this a show stopper for using a spa or is there a work around?
I seem to be able to find very little on this on the net so I'm wondering if this requirement would mean creating a normal mvc site?
Its possible to upload files using ajax, so no show stopper there. you might need a controller to accept the file though, but that shouldn't be an issue.
Check out this tutorial on an ajax upload
http://tutorialzine.com/2013/05/mini-ajax-file-upload-form/
or you can check out uploadify, i think that does file upload via ajax too
Is it possible to implement paste picture in grails? Or drag&drop picture like in gmail for example.
Of course, and this is not a Grails question as anything you do to solve this problem is client side related. The end result would just be a multipart form POST to the server anyways.
Example of how to implement on client side:
http://www.thecssninja.com/javascript/drag-and-drop-upload
http://html5demos.com/file-api
Grails end of things is identical to how you implement regular file uploading, don't see any point in showing examples for that.
In JIRA it is possible to create new issues through a simple GET request: http://confluence.atlassian.com/display/JIRA/Creating+Issues+via+direct+HTML+links.
A simple example of such a link:
"http://jira.atlassian.com/secure/CreateIssueDetails!init.jspa?pid=10420&issuetype=3&summary=say+hello+world"
This would create a new issue in project with PID=1042 with summary "Say Hello world".
Is there Redmine plugin/api which allows for such a use case? The REST API is inconvenient for my use since I would like to allow users to create new issues (with pre filled data) through a link sent in email and I don't want to use JavaScript for the job (to send the REST json/xml data).
EDIT:
From what I see (http://www.redmine.org/projects/redmine/wiki/RedmineReceivingEmails) Redmine provides an email API for submitting issues, this would be a parital solution. I would be able to add a "mailto:" link which would pre fill the content of the message.
This solution requires additional emails so still I would prefer to have a post link solution.
I have implemented a basic plugin which fulfills my needs. You can find it at:
http://code.google.com/p/redmine-post-link-plugin/
You could also have a server-side script that actually sends the e-mail. There's no post link solution as far as I know.
You might want to look at the Redmine API for updating and creating issues.
http://www.redmine.org/projects/redmine/wiki/Rest_Issues
In Redmine2 there is oficial API for it.
If I wanted to do a GET request I could just use document.location = "what-ever-I-want". But how do I do that with YUI?
I was told that I can't do it with YUI 2 Connection Manager and afaik I really can not. Then I was told that I can do it with YUI 3, but in trying to do so I've not found the answer and I'm thinking I really can't.
Please notice that I DON'T want to use Ajax, but a regular post.
I need this to make a link send a POST request, instead of GET.
[b]I know I can work around creating a form with JS and I'm doing that right now, but isn't there a more cleaner way?[/b]
Create a form making sure to set
method="post"
then insert it into the document, get a reference to it & call
.submit()
on it.
Tivac answer is the way to go.
I've discussed about this with him and some other people on #yui channel on freenode and yes, what he said is what we should be doing.
I've decided to open a feature request ticket for this to be implemented on YUI. You can check it out at http://yuilibrary.com/projects/yuilibrary/ticket/2528278
This might be of interest: JavaScript post request like a form submit