Posted by seqal on December 15, 2011 at 9:23am
3 followers
| Project: | Answers |
| Version: | 7.x-3.x-dev |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Issue Summary
I've used Answers to create a straightforward Q&A system. There's one little thing that's got me stuck. The answers list generated by the "Answers to a Question" View includes links (via the titles) to specific pages for each answer.
I'd like to remove the < a > tags, so there are no links, but cannot work out how to do this (I've tried modifying the Answer content type and the "Answers to a Question" View but no luck so far).
Any help would be very much appreciated.
Comments
#1
Thanks for this request. This is a great idea. There's no point in having that link and it can be confusing.
Unfortunately, I am not sure of the simplest way to do this. I have posted a question to ask for help.
One way I believe would work would be to rebuild the "Answers to a Question" view using the "Field" row type instead of the "Node" row type. But let's see what suggestions come in.
Once this is settled, I'd like to port this back into the module. Thanks again for raising the idea.
#2
Patch:
Note that this patch is specific to drupal 7; the way to add overriding templates in modules in d6 is different.
#3
Meh, this is a single use case and should be a sub module or such.
#4
I think this is a great idea and should get integrated into the module.
I tried it out and had two questions.
Question 1: I found that the "submitted" text was formatted differently when I used this patch.
Question 2: I found that user pictures on the "submitted" line were omitted.
Both of these may have to do with the base them I am using, which is Bartik.
To have it rendered the same, I needed to use the same code in node-answers.tpl.php for the "submitted" line as used in the Bartik node.tpl.php:
<?php if ($display_submitted): ?><div class="meta submitted">
<?php print $user_picture; ?>
<?php print $submitted; ?>
</div>
<?php endif; ?>
This code adds the "meta" class and $user_picture. I'm not experienced in theming. Were these choices intentional?
#5
As both an upgrade path and to support different use caseS (for example, displaying comments on answer, may want answer node page to be useful), it'd prob be best to add a simple configuration.
Hm, I'd need to look into it more, but I believe I just copied the base node.tpl.php and removed the title line. May have copied the wrong one.
#6
So, it looks like you started with the Garland node.tpl.php. And I started with the Bartik node.tpl.php. And the two are a bit different.
On configuration, my thought is that the node-answer.tpl.php is simple enough to edit. So, that's a way to provide great flexibility for those who are comfortable themers.
My thought is that we should simply pick as the base whichever one is most popular. How's that sound? (And if it sounds reasonable, any thoughts on how we could figure that out?)
#7
Bah, I wish node templates had a way to disable title without overriding.
Currently the title is there, so I'd lean to defaulting to that (not sure how to figure out which one is more popular)
#8
OK, sounds good, let's keep what you've already done.
#9
If anyone is currently using the fact it links, this would screw with that, so it does need configuration at least as an upgrade path. Working on that + cleaning up some documentation.
#10
Updated patch, trying to add more documentation + adding a setting. I'm so not good at describing settings though.
#11
Oh, the patch, I could add it.
#12
Patched tested and validated.
At the same time, I have a thought about how to describe it:
Given all that, here's my thought. How about we describe the setting not so much in terms of the specific feature ("Navigation to answer page") but rather in terms of the general use of the templates (e.g., "Use Answers templates for question and answer nodes" --> "This will ignore the base theme node template and use custom templates. Currently the main difference is that the titles in answer node listings are not linked to their node pages").
We might also make it default to use the custom templates, since I think that will be better for the vast majority of users.
As far as documentation, what I imagine would be helpful would be a little description about how one can customize the look of answers and questions by editing your own templates. We could write that later.
Whaddya think?
#13
Sounds good to me; do you want to update the patch with it?
Since the current behavior is to allow navigation, should likely add an answers_update_x that variable_set's that option (and change the default value).
#14
OK. Done in the attached patch. I also added answers_update_7300. Don't need to set the variable (it has the right default option). But do need to reset the theme cache.
#15
#16
I've now ported the patch.
In doing so, I made some changes. The patch had two functions.
Provide an answers node template the removes the link to the answers node
I made these changes:
Redirect users who go to a path that leads to an answer node to the answer's question page, scrolling to the answer itself
I retained a setting for this. I renamed it to 'answers_redirect_from_answer_to_question_nodes_p'.
Patch attached and committed to 6.x-2.x.
#17
Whoops ... meant to mark this to port *back* to 7.x-3.x
#18
Ported to 7.x-3.x-dev