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

implement copy link and copy source buttons in snippet details #24

Merged
merged 3 commits into from
Sep 11, 2015
Merged

implement copy link and copy source buttons in snippet details #24

merged 3 commits into from
Sep 11, 2015

Conversation

abjrcode
Copy link
Contributor

@abjrcode abjrcode commented Jul 6, 2015

this resolves issue #9

@tpetricek
Copy link
Member

Thanks for looking into this - I actually quite like how this looks!

Here are a few comments after playing with this a little:

  • The "Copy source" button works nicely, but "Copy link" does not do anything on my machine. Not sure what's going wrong. How can I help to debug this?
  • If the snippet source is really long (try e.g. http://localhost:8083/r5), then the window is larger than the page. Can you make set max-height (or something) to, say 80% of the window and enable scrollbars (and also make it a bit wider for copying source)?

Nice work :) looking forward to having this merged!

@abjrcode
Copy link
Contributor Author

abjrcode commented Jul 7, 2015

Thanks. I haven't been around any sort of web development for two years now, so I had to read about all those technologies in a short amount of time, thus you might find my coding style especially with JavaScript a bit crappy.

  • As for the Copy source button on your machine. I suspect you need to change the the URL targeted by the AJAX request in the copyContent.js:
    var snippetSourceUrl = 'http://localhost:8083/raw/' + snippetId;
    according to the build you are running as you might by getting a not the same origin exception. If that is not the case then please check your browser's console for any JavaScript errors or warnings. What browser are you using by the way ?
  • Regarding the above error, I think these URLs along with other configuration should be loaded during build conditionally depending on target, I will look further into this.
  • I will definitely look into the sizing issue. One thing Tomas. I would appreciate if you can test this with multiple browsers as my dev machine is a bit slow and can't handle installing multiple browsers. Thank you.

@abjrcode
Copy link
Contributor Author

Hi Tomas.

The modal size is now dynamically adjusted.
This leaves the other problem with source. What's up with that ?
Another thing: How do you access the HttpRequest from inside a template page ? I couldn't find that in Suave documentation.

@tpetricek
Copy link
Member

I have not yet looked into the problem with source. Does this work for you?

As for accessing the HTTP request info, this is not automatically exposed to the template page. You need to modify the F# record that is passed to the template (see this piece of code) and pass all data that you need there.

Here is an example that shows how to extract the body of a HTTP request and how to access URL parameters.

@abjrcode
Copy link
Contributor Author

Yes. showing the source works perfectly on my device.

Could You check your browser's console for any JavaScript exceptions ?

@abjrcode
Copy link
Contributor Author

Hey Tomas.

I have pushed another commit which should fix the issue completely.

Please let me know about the "show source" problem on your machine.

tpetricek added a commit that referenced this pull request Sep 11, 2015
implement copy link and copy source buttons in snippet details
@tpetricek tpetricek merged commit d4a8fdc into fssnippets:master Sep 11, 2015
@tpetricek
Copy link
Member

It took a long time (holidays + work!) but I finally deployed this to Azure: http://fssnip.azurewebsites.net/
The script seems to be working fine in Chrome, but there is something broken in IE (at least on my machine)

Also, now that it's running on Azure, it will be a lot more fun to complete the rest - any PR into master will immediately affect the web site!

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

Successfully merging this pull request may close these issues.

2 participants