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

JSON API for wiki pages #1069 #1071

Merged
merged 4 commits into from
Dec 6, 2016
Merged

JSON API for wiki pages #1069 #1071

merged 4 commits into from
Dec 6, 2016

Conversation

500swapnil
Copy link
Collaborator

@500swapnil 500swapnil commented Dec 6, 2016

Make sure these boxes are checked before your pull request is ready to be reviewed and merged. Thanks!

  • all tests pass -- rake test:all
  • code is in uniquely-named feature branch, and has been rebased on top of latest master (especially if you've been asked to make additional changes)
  • pull request is descriptively named with #number reference back to original issue
  • if possible, multiple commits squashed if they're smaller changes
  • reviewed/confirmed/tested by another contributor or maintainer
  • schema.rb.example has been updated if any database migrations were added

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/wiki/contributing-to-public-lab-software

We have a loose schedule of reviewing and pulling in changes every Tuesday and Friday, and publishing changes on Fridays. Please alert developers on plots-dev@googlegroups.com when your request is ready or if you need assistance.

Thanks!

@@ -41,13 +41,18 @@ def show
.page(params[:page])
.order("node_revisions.timestamp DESC")
end

respond_with(@nodes) do |format|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, but I think this has to go down on line 51, at the end of the action method, or some of the variables used in the templates won't exist when we try to render it. Make sense? Thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay will do it.

@notes = nodes.where('node.nid NOT IN (?)', qids) if @node_type == "note"
@questions = nodes.where('node.nid IN (?)', qids) if @node_type == "questions"
@wikis = nodes if @node_type == "wiki"
@nodes = nodes if @node_type == "maps"
@title = params[:id]
set_sidebar :tags, [params[:id]]

respond_with(@nodes) do |format|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, and i mistyped -- this should be @notes, not @nodes. Sorry! and on lines 53-4.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apologies!

@500swapnil
Copy link
Collaborator Author

Is it ok now?

@jywarren
Copy link
Member

jywarren commented Dec 6, 2016

It looks good, lets see how the tests do! Thanks!

@jywarren
Copy link
Member

jywarren commented Dec 6, 2016

Hmm, ok your test didn't pass:

================================================================================
Error: test_tag_show_JSON(TagControllerTest): TypeError: no implicit conversion of ActionController::TestResponse into String
test/functional/tag_controller_test.rb:110:in `block in <class:TagControllerTest>'

Let's see...

@500swapnil
Copy link
Collaborator Author

What should I do?

@jywarren
Copy link
Member

jywarren commented Dec 6, 2016

Oh, you know what, i think maybe it needs to be:

json = ActiveSupport::JSON.decode(@response.body)

Can you try that?

@jywarren
Copy link
Member

jywarren commented Dec 6, 2016

I'll be in transit for 15m, but can check on this later, thanks!

@jywarren
Copy link
Member

jywarren commented Dec 6, 2016

Perfect; merging now! 🎉

If you're looking for a new challenge, please take a look at our help-wanted list: https://github.com/publiclab/plots2/labels/help-wanted

Thanks!

Oh, and also -- for future reference, it's important to do your development on a named feature branch -- you can read more here:

https://publiclab.org/wiki/contributing-to-public-lab-software#A+sample+git+workflow

And there are instructions on rewinding back your master branch here:

https://publiclab.org/wiki/contributing-to-public-lab-software#Rewinding+the+master+branch

Thanks again!!!

@jywarren jywarren merged commit 71d07bc into publiclab:master Dec 6, 2016
@500swapnil
Copy link
Collaborator Author

Okay thank you!!

@jywarren
Copy link
Member

jywarren commented Dec 6, 2016 via email

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.

None yet

2 participants