Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share on PublicLab.org button #63

Open
jywarren opened this issue Jul 14, 2014 · 1 comment
Open

Share on PublicLab.org button #63

jywarren opened this issue Jul 14, 2014 · 1 comment

Comments

@jywarren
Copy link

I tried using:

window.location = "http://publiclab.org/post?i="+getCurrentImage()

however the request is too long. We need to do it via POST, perhaps

 $('body').append("<form method='post' id='share-publiclab' action='http://publiclab.org/post'><input name='i' value='"+getCurrentImage()+"'/></form>");$('#share-publiclab').submit()

But this seems to be choking on the "filename":

Completed 500 Internal Server Error in 216ms

ActionView::Template::Error (undefined method `length' for nil:NilClass):
2:
3:   <h3 style="margin-top:0;" class="hidden-phone">Main image</h3>
4:
5:   <img class="img-rounded" id="leadImage" <% unless (@node && @node.main_image) || params[:main_image] || params[:i] %>style="display:none;" <% end %>src="<% if @node && @node.main_image %><%= @node.main_image.path(:default) %><% elsif params[:main_image] && Image.find_by_id(params[:main_image]) %><%= Image.find_by_id(params[:main_image]).path %><% elsif @image %><%= @image.path(:default) %><% end %>" />
6:   <div class="side-dropzone" id="side-dropzone">
7:     <p class="prompt"><span class="hidden-phone">Drag &amp; drop to add an image, or </span><span class="fileinput-button"><a><i class="icon icon-upload visible-phone pull-left" style="padding-right:6px;"></i> choose an image</a><input tabindex="3" id="side-fileinput" type="file" name="image[photo]" style="height:4em;"></span></p>
8:     <br class="hidden-phone" />
app/models/image.rb:31:in `filetype'
app/models/image.rb:27:in `is_image?'
app/models/image.rb:35:in `path'
app/views/editor/_main_image.html.erb:5:in `_app_views_editor__main_image_html_erb__439734243163691178_53754740'

I'm guessing this is because the data_url does not have a filename in its url string. With some tweaking i think we could work around this...

@jywarren
Copy link
Author

Been chipping away at this on the publiclab.org codebase here: publiclab/plots2#201

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant