JTWWilson / resources

Resources for various subjects and their examinations. All welcome to add content via pull requests.
https://jtwwilson.github.io/resources
1 stars 1 forks source link

Online Typo Corrections #31

Closed JTWWilson closed 8 years ago

JTWWilson commented 8 years ago

Is it possible to add a text input box onto the site so that anyone can catch spelling errors or even suggest enhancements?

Also, explore whether it is possible to connect this up to GitHub Issues.

stanley-godfrey commented 8 years ago

It could be done, perhaps with an HTML form feeding into a PHP/JavaScript back-end sending an email in our direction. Regarding GH Issues, they can only be made through GitHub as they are not a Git feature.

stanley-godfrey commented 8 years ago

Just done some research and, if we want to have this, it would need self-hosting

JTWWilson commented 8 years ago

You can use the Github API to interact with GitHub issues.

stanley-godfrey commented 8 years ago

Just been doing some research and it's come to my attention that, to create an issue, you need a GitHub account. Thus, would it be better to create a "bot" account that we can use to create issues?

JTWWilson commented 8 years ago

If you want, go for it. This is as far as I got yesterday, if it helps: https://gist.github.com/fabcooldog/e20280192f7bfe4e8ab19362df413f5c

stanley-godfrey commented 8 years ago

Well so far I've had to set up a web server on my Linux box to even do anything (Also, it needs doing in PHP to use the API I believe)

JTWWilson commented 8 years ago

Why do you need to set up a separate server? I've just used Javascript's XMLHTTPRequest object to get and post data using the API.

stanley-godfrey commented 8 years ago

I beg your pardon, I'm doing it with JS now, should be working soon-ish as I've pretty much a copy-and-paste job now

JTWWilson commented 8 years ago

What are you copying and pasting? Could you make a quick Gist so I can see what you're doing?

stanley-godfrey commented 8 years ago

I'm just adapting your code to use an HTML form

JTWWilson commented 8 years ago

Mine doesn't work

JTWWilson commented 8 years ago

It gets data perfectly but post isn't working. I get an error: The system cannot find the path specified.

stanley-godfrey commented 8 years ago

Well I'll get the form accessing done first and then make a Gist... How do I Gist?

JTWWilson commented 8 years ago

Big Gist button at the top of the page (Leave it secret for now -- if you link to it here I can access it)

stanley-godfrey commented 8 years ago

Ahh yes... Also, that auth code in your Gist... Am I able to use that or will it go :scream:

JTWWilson commented 8 years ago

You can use it perfectly I think. If you're getting an error you could always try generating your own (your profile > developers)

stanley-godfrey commented 8 years ago

Okay. Would it be worth, like I mentioned above, making a dedicated issues user which we could use to make the issues, rather than leaving our accounts to do it?

JTWWilson commented 8 years ago

For now, new issues is probably best. However, in the future, using HTML, you can make a drop-down list that generates either a comment on an issue entitled typos/page suggestion etc. or a new issue.

stanley-godfrey commented 8 years ago

Here

It's not making an issue though

JTWWilson commented 8 years ago

That is because of two things:

  1. If you want to submit something to the site you need to use post in your request
  2. When you correct (1), you get the following error:

HTTP400 BAD REQUEST - The request could not be processed by the server due to invalid syntax. (XHR)POST - https://api.github.com/repos/fabcooldog/resources/issues

I got this error yesterday and hadn't started looking to resolve it.

stanley-godfrey commented 8 years ago

I corrected the GET to POST and, yes, I'm now getting an HTTP 400. I'm now reading the docs and says that all we should need is the issue title and body.

stanley-godfrey commented 8 years ago

Do I have pull access?

JTWWilson commented 8 years ago

To what? Also, I'm sure you need an authentication key as, without it, GitHub doesn't know who is posting the issue.

stanley-godfrey commented 8 years ago

The repository

JTWWilson commented 8 years ago

No one has pull access, I'm happy to approve any changes you make, though. Also, do remember that you can work in a branch, in which you will have full access

stanley-godfrey commented 8 years ago

I've found the problem... You need pull access to create an issue using the API:

Any user with pull access to a repository can create an issue.

JTWWilson commented 8 years ago

Whose key are you using? If it is either of ours then it is fine -- we can create issues and have pull access; the approvals system just limits pull requests, not issues.

JTWWilson commented 8 years ago

Nevertheless, I can disable the approvals for the sake of testing this. - Done.

stanley-godfrey commented 8 years ago

IT'S FREAKING WORKING!!!!!!!!!

JTWWilson commented 8 years ago

With whose key? Try again after I reconnect the approvals.

stanley-godfrey commented 8 years ago

My key

JTWWilson commented 8 years ago

OK, try now.

stanley-godfrey commented 8 years ago

Look in the issue tracker :laughing:

JTWWilson commented 8 years ago

Fantastic, could you pop it up on that Gist you made so I can try it at Chez Me?

stanley-godfrey commented 8 years ago

What's on the menu at Chez Me tonight? :laughing:

stanley-godfrey commented 8 years ago

Gist

JTWWilson commented 8 years ago

Javascript and Further Maths 🎈

stanley-godfrey commented 8 years ago

So, what now?

JTWWilson commented 8 years ago

We need to look at the implementation: instead of copying this into every page, we should put a (relative) link to the Javascripts folder in the head.

stanley-godfrey commented 8 years ago

Okay. It should be pretty simple to do so. Just chuck a rel link into the head and that should be it. I'll quickly check it though

stanley-godfrey commented 8 years ago

Updated Gist

JTWWilson commented 8 years ago

Furthermore, the input box should have a custom ID that attaches to some CSS that automatically adds the labels to the input boxes to make the site more flexible to update. Finally, we might want to look into the following:

stanley-godfrey commented 8 years ago

What do you mean by the labels?

JTWWilson commented 8 years ago

The First Name: signs and placeholder text for the boxes.

stanley-godfrey commented 8 years ago

Why would they need attaching to the boxes? Next thing I know you'll start adding crates as well

JTWWilson commented 8 years ago

I'm not sure how you would do it. Perhaps through divs. Nevertheless, add your current version on to the footer of the main index page - great work!

stanley-godfrey commented 8 years ago

Pull request #37