-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Begin converting Map nodes into normal note nodes #4072
Comments
Added to GCI! |
@publiclab/mentors if I've understood this correctly, we are trying to convert all the |
I don't think it's especially linked, but you have the idea on the node
types. Yes!
…On Wed, Dec 5, 2018 at 6:08 AM Oorjit Chowdhary ***@***.***> wrote:
@publiclab/mentors <https://github.com/orgs/publiclab/teams/mentors> if
I've understood this correctly, we are trying to convert all the map nodes
into normal note nodes and we are integrating maps in all the nodes ...
Which means this task is also linked to #4066
<#4066> .. Am I right?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#4072 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJ67E0bEIMI-0aKCgnIA6WPkl4UQBks5u16kbgaJpZM4Y6S6P>
.
|
Noting a great question from the chatroom:
|
Hey @jywarren. I have a doubt, I believe we are deprecating the drupal_content_type_map model, and as mentioned in this issue #956, we are merging the drupal_content_type_map model to the map node body field. Since the body of a node is a text field, how can we merge the content_type_map table in that as it contains several columns? Thank you! |
or are we doing it using hashes? |
Hi @gaurav2699 sorry for my too-late response. We are hoping to simply write out HTML or Markdown for each entry in the @node.body += "<p><b>Mapped by</b> #{ @node.drupal_content_field_mappers.collect(&:field_mappers_value).uniq.join(', ') }</p>"
@node.body += "<p><b>Cartographer:</b> #{ @node.drupal_content_field_map_editor.collect(&:field_map_editor_value).uniq.join(', ') }</p>"
@node.body += "<p><b>Published by</b> <a href='/profile/#{ @node.author.name }'>#{ @node.author.name }</a></p>" Does this make sense? |
@jywarren , please I'm a bit confused on what is to be done as this code has already been implemented on app/views/map/show.html.erb lines 35 to 40. |
@TildaDares , the above code has already been implemented . please are we to include more entries (trruncate_fields, tms, min_zoom, max_zoom, cartographer_notes, license, notes, published_on, captured_on) of the |
Sorry, to clarify-- yes, similar code exists on show.html.erb -- however, what were proposing is that we use this very similar code to permanently insert generated HTML into the node body field, and store it that way in the database, so that we can then remove fields like By using the code segment I proposed, we adapt the template code into a database migration, and run it once, to insert all this permanently into the node body field. Although actually now that I think of it, the body field is part of the revision model, not the node model. So we'd have to edit that -- revision = @node.latest
revision.body += "<p><b>Mapped by</b> #{ @node.drupal_content_field_mappers.collect(&:field_mappers_value).uniq.join(', ') }</p>"
revision.body += "<p><b>Cartographer:</b> #{ @node.drupal_content_field_map_editor.collect(&:field_map_editor_value).uniq.join(', ') }</p>"
revision.body += "<p><b>Published by</b> <a href='/profile/#{ @node.author.name }'>#{ @node.author.name }</a></p>"
revision.save Does that make more sense? |
It does , thank you. |
This is an exciting advancement!~ |
We have a range of nodes at https://publiclab.org/maps which are of type
map
, sonode.type == 'map'
. See one here: https://publiclab.org/map/chandeleur-islands-louisiana/2010-06-09Let's migrate them to a simpler form of node, type
note
- but copy all the extra fields into the note body (actually part of the note's Revision record). We could do this in a migration kind of like this:See how we can use Markdown to display all the relevant data in a simpler format, but still roughly in the arrangement we'd had in the original custom template:
plots2/app/views/map/show.html.erb
Lines 34 to 46 in f9f0948
Let's not forget also the different forms of export we can display:
plots2/app/views/map/show.html.erb
Lines 26 to 29 in f9f0948
Finally, let's embed a map as in the original display, at the top of the body content, using this line:
Once we can demonstrate that this works (please upload a screenshot of your script working; you can test it out on the rails console by running it with
rails console
interactively), we can turn it into a migration like one of these:https://github.com/publiclab/plots2/blob/master/db/migrate/20180707065151_change_status_of_comments.rb
Follow-ups: removing the maps type code, including ones like this: https://github.com/publiclab/plots2/blob/master/app/models/drupal_content_field_map_editor.rb
and stuff inside https://github.com/publiclab/plots2/blob/master/app/views/map/
This is a bit complex but is a great exercise in Rails-style models and migrations! It'd also help resolve #956
The text was updated successfully, but these errors were encountered: