1. Add header menu links? 2. Add pages to the help-menu?

45 views
Skip to first unread message

elle...@hotmail.se

unread,
Mar 20, 2020, 10:31:02 AM3/20/20
to Alaveteli Dev

Hi!


Two questions:


1. We can’t seem to find how to add header menu links. How do we add pages as separate pages like the front page? With a similar layout? But as a standalone page?


2. We're trying to use the documentation on how to route the pages using custom.routes but our site simply goes blank. The current documentation is not up to date on how to do it. When we try to do it our development machine breaks Alaveteli. What are the necessary steps to add pages to the help-menu? Can anyone who modified their default theme extensively link it to us and share procedure for deploying changes?"



Best,

Handlingar.se Team

Gareth Rees

unread,
Mar 23, 2020, 5:42:18 AM3/23/20
to Alaveteli Dev
We try to tag all alaveteli-related repositories, including themes we maintain, so you can search them via GitHub [1].

1. We can’t seem to find how to add header menu links.

Belgium have custom nav items [2]. You need to override `views/general/_nav_items.html.erb` in your theme.

How do we add pages as separate pages like the front page?

First, its worth saying that we recommend against heavily customising the built-in pages of alaveteli, as it can create a lot of maintenance work for you.

If we make changes that are required for the application to function correctly, you'd need to pull those in, reconciling the upstream code against your changes.

Anyway, with that said, you can add new pages either by adding new controller actions to an existing controller [3] (and then providing templates) [4].

Alternatively, you can add entirely new controllers [5] again with corresponding views [6].

You can see the routes for Belgium and Nicaragua in `lib/config/custom_routes.rb` in each of those repos.

The current documentation is not up to date on how to do it.

elle...@hotmail.se

unread,
Apr 21, 2020, 6:34:05 AM4/21/20
to Alaveteli Dev
Thank you!

We have two languages on our site, and I can't seem to find how to add so the new topmenu changes with the language change?

Thanks again,

Elenor

Gareth Rees

unread,
May 11, 2020, 11:08:13 AM5/11/20
to Alaveteli Dev
Hey Elenor,

Theme translations need a separate theme repository on transifex [1].

Best,


--
Gareth

Mattias Axell

unread,
Feb 17, 2022, 1:27:42 PM2/17/22
to Alaveteli Dev
Hi! Question regarding 2. Add pages to the help-menu?

@Gareth - We're at this trying again and I have tried my best to follow the instructions from documentation and your reply and have done the following changes for page "terms" which is our equivalent to WDTK "house_rules":


Currently something seems to work but no content is loading: https://dev.handlingar.se/en/help/terms

What am I doing wrong? I'm not sure of what I'm doing and what I need to change to fix. I feel I'm missing a straight and simple example, could maybe an example custom page be included in alavetelitheme and not commented out?

Best,
Mattias
måndag 23 mars 2020 kl. 10:42:18 UTC+1 skrev Gareth Rees:

Gareth Rees

unread,
Feb 22, 2022, 7:02:28 AM2/22/22
to Alaveteli Dev
Ah, looks like the problem lies in:

https://github.com/handlingar/handlingar-theme/blob/0.39.1/lib/controller_patches.rb

You've tried to define the route again. You need to patch HelpController with a method called terms.


So I think your full controller_patches.rb (aside from the comments at the head of the file) should look like:

Rails.configuration.to_prepare do
  HelpController.class_eval do
    def terms; end
  end
end


Best,

Gareth

Mattias Axell

unread,
Mar 23, 2022, 3:04:28 PM3/23/22
to alavet...@googlegroups.com
Hi,

Ok so I commented out everything except adding what you suggested and with addition from WDTK.


but I get error:
A NoMethodError occurred in help#terms:

  undefined method `set_history' for #<HelpController:0x00005603aa6b6828>
Did you mean?  set_last_body
  app/controllers/application_controller.rb:115:in `record_memory'


--
You received this message because you are subscribed to a topic in the Google Groups "Alaveteli Dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/alaveteli-dev/o31mESSUlII/unsubscribe.
To unsubscribe from this group and all its topics, send an email to alaveteli-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/alaveteli-dev/e5518efa-af0c-46cd-906e-4a7ccade29cdn%40googlegroups.com.

Graeme Porteous

unread,
Mar 24, 2022, 12:51:08 PM3/24/22
to alavet...@googlegroups.com
Hi Mattias,

Looks like you've also copied over the `before_action` line.

All the best,

--
Graeme Porteous
gra...@mysociety.org


You received this message because you are subscribed to the Google Groups "Alaveteli Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alaveteli-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/alaveteli-dev/CAEJghOr-2%2BSbAGOH_rv1CFsgNOfsLP9595bw_BS4kfv7AkTY-g%40mail.gmail.com.

Mattias Axell

unread,
Mar 24, 2022, 3:07:55 PM3/24/22
to alavet...@googlegroups.com
Thanks a lot Gareth!

I also had to remove render partial %history from each terms-page after trying your fix and now it works!

Best,
Mattias

Reply all
Reply to author
Forward
0 new messages