Coder Social home page Coder Social logo

amnav's People

Contributors

dubcanada avatar hahnzilla avatar hubertprein avatar janhenckens avatar jayelkaake avatar nfourtythree avatar raymondelooff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amnav's Issues

target not added in "build your own" menu

Hi,

We've created a "build your own" type of menu according to your example. however when you add a menu item that should open in a new (blank) page, the code is not rendered in the actual "build your own" menu.

{% set nav = craft.amNav.getNavRaw("mainMenu") %}

{% macro addPageToNavigation(page) %}
<li class="{% if page.active %} active{% endif %} {% if page.children is defined %} dropdown{% endif    %}">
    <a href="{{ page.url }}" title="{{ page.name }}" {% if page.children is defined %}class="dropdown-toggle" data-toggle="dropdown"{% endif %}>{{ page.name }} {% if page.children is defined %}<b class="icon-angle-down"></b>{% endif %}</a>

    {% if page.children is defined %}
        <ul class="dropdown-menu">
            {% for subpage in page.children %}
                {{ _self.addPageToNavigation(subpage) }}
            {% endfor %}
        </ul>
    {% endif %}

</li>
{% endmacro %}

<ul class="level0 nav navbar-nav navbar-right">
{% for page in nav %}
    {{ _self.addPageToNavigation(page) }}
{% endfor %}
</ul>

{{ craft.amNav.getNav("mainMenu") }}

How do you use getActivePageIdForLevel

Link - #5

@hubertprein Just wondering how you go about using that getActivePageIdForLevel function in conjunction with the startFromId parameter?

A bit of a newb to Craft and associated plugins so not too sure how you code this sort of thing? Didn't see it mentioned in the Docs either so a little confused as to exactly how to do that sort of thing as mentioned in the post linked to above.

Many thanks in advance for any help with this.

P.S. Apologies for posting to a closed issue like that.

Blind Links for Top Level

Is it possible to have an entry in the main navigation where the top level does not link anywhere but the child items do?

I can enter a "#" for the url but just wanted to see if you had any other suggestions.

Make nav links translatable

If you can use the craft_content table for any content or just make it so that content can be translated that'd be great.

Ability to update node URLs after adding them.

I built a nav and it worked great, then I changed the URI structure for my sections, and their entries now have different URIs. It would be fantastic if we could update the nav based on how an entry builds its URI after the fact.

Another side effect of this, double clicking a node, the entry shows the correct (updated) URI. Saving that node, the URL is not updated within the url column in craft_amnav_nodes.

Please reach out with any questions. The latest update and new UI are fantastic!

Add Categories or Category Group

Would be great to be able to select either existing individual categories or category groups to add to menus, just like entries work. Aware that you can add these in manually, but from a maintenance point of view, it'd be great that navigation items update when category url's change.

An even greater feature would be to select a top-level menu item and have its children auto-populate with a selected category.

Specify sections from which entries can be chosen per-menu

Great work on this plugin. I'd like to see an option to choose which section(s) should be included in the entry modal.

I found a way of hardcoding this in the javascript, but it would be great as a per-menu setting :)

# AmNav.js
/**
* Create EntrySelectorModal.
*/
createModal: function() {
    return Craft.createElementSelectorModal("Entry", {
        sources:['section:19'], // <-- Add this line
        multiSelect: true,
        onSelect:    $.proxy(this, 'onModalSelect')
    });
},

After an entry is edited it automatically changes status in AMNav

Version: AMNav 1.6.8

We are having an issue where when an A&M Nav menu item is tied to entry, any change to that entry overrides A&M Nav's status (disabled to enabled) across all locales even if that's locales entry is disabled. Also, if the entry's title is changed it automatically updates the menu item title.

Our use case is that we have a menu that is different for each locale. During a beta launch period locale A we are disabling a few of the nav items. On locale B we have the page published and are making updates. When updates happen for locale B, it changes the menu item in locale A and changes the status from disabled to enabled automatically.

The desired functionality should be not to override AM Nav items on entry update, especially across locales and locale entry status.

As a work around, I have recreated the menu using custom links rather the entry links.

Thank you,
Taylor

Sample template code to generate same html as just using the tag

Hey Guys,

Would it be possible to amend the sample code, or add new! that matches the output that just using the tag would generate? The tag alone almost outputs the html i need, but not quite. I have tried using the tags to output my own html, but i can't seem to get the html to output in the same way as just using the tag.

I hope that makes sense!

Thanks

John

How Can I display Parent of a specific Node?

I am trying to display a node and it's parent and I can't figure it out. Here is my code:

            <h3>I NEED TO GET THE PARENT NODE TITLE HERE</h3>
                {{ craft.amNav.getNav("mainNavigation", {
                id: 'subnav',
                startFromId: 2,
                maxLevel: 1
            }) }}

What am I doing wrong?

Referenced entries do not propagate updates.

If I reference an entry in a nav item, then change that original entry's title, the nav item does not update.

I assume this is because static copies are stored in the table. The entryID is still stored in that same record so I'm not sure why you don't dynamically pull in those values vs. cloning.

Best practice to allow users to include a menu on a particular entry.

I had setup a Craft site with the navigation menus hard-coded/overridden in the relevant templates, e.g.:

{% block internalSidebar %}
    {{ craft.amNav.getNav("commercialSideMenu") }}
{% endblock %}

...with the user being able to edit existing menus in the back-end as required.

Is there a(n easy) way to specify a "Menu" field type for an entry such that a user could add a navigation menu by selecting it from the list of available menus?
Thanks,
Adam

Can't upgrade from 1.4.3

I am trying to upgreade to latest version 1.5.3 and I just keep getting an error and rollback message. I am on version 1.4.3.

Localised navigation

Hi,

I was wondering if there were plans to make the navigation translatable? Right now the only way I can see using amnav for a multilingual site is to set up locale-specific navigations for each language. It's a workaround, but rather tedious.

Cheers,
John

Additional fields for manual url

While building a mega-menu style menu, I've come across the need to be able to customise headings inside the dropdown menu. What would really help with this, is if an additional field (title or class maybe?) was available to enter this information.

You can see what I mean from the below image -
screen shot 2014-12-13 at 2 20 35 pm

Where the inner "See & Do" heading would need to be customised to a desired string. Can certainly be done statically within the template, but would be great for a client to be able to edit this from the CP.

I've achieved something similar before with NavEE, as it offers so-so many extra fields for customisation of menu items.

Need Help With Classes Please

How can I add classes to deeper nodes and anchors like you see below?

<ul id="slide-out" class="side-nav">
<li><a href="#!">First Sidebar Link</a></li>
<li><a href="#!">Second Sidebar Link</a></li>
<li class="no-padding">
  <ul class="collapsible collapsible-accordion">
    <li>
      <a class="collapsible-header">Dropdown<i class="mdi-navigation-arrow-drop-down"></i></a>
      <div class="collapsible-body">
        <ul>
          <li><a href="#!">First</a></li>
          <li><a href="#!">Second</a></li>
          <li><a href="#!">Third</a></li>
          <li><a href="#!">Fourth</a></li>
        </ul>
      </div>
    </li>
  </ul>
</li>

Template Error

This was done on a dev environment after the Craft 2.5 beta came out. Steps taken:

  1. Upgrade Craft to 2.5.2715
  2. Upgrade amnav from 1.1.7 to 1.7.0
  3. Navigate to http://craft.dev/admin/amnav
  4. Template error:
Template Error

Variable "menus" does not exist

/Users/dgrebb/Projects/00 Sandbox/craftcms/craft/plugins/amnav/templates/_index.twig(17)

05 
06 {% if currentUser.admin or settings.canDoActions %}
07     {% set sidebar %}
08         <div class="buttons">
09             <a href="{{ url('amnav/new') }}"><div class="btn submit add icon">{{ 'New navigation'|t }}</div></a>
10         </div>
11     {% endset %}
12 {% endif %}
13 
14 {% set content %}
15     <h1>{{ 'Created navigations'|t }}</h1>
16 
17     <div id="nonavigations"{% if navigations %} class="hidden"{% endif %}>

Line 17 is the one in question. Any ideas?

Wrong Url in Navigation and no "active" state

Tried your Plugin and like it alot, but i get two errors in the output:
1 - The URLs in the navigation includes the domain name twice, e.g.:

<a title="Impressum" href="http://www.domain.com/http://www.domain.com/index.php?p=impressum">Impressum</a>

This happens using craft.amNav.getNav() and craft.amNav.getNavRaw()

2 - The class "active" is not set, maybe it's because the url ist not correct.

id en class of nav not set by default

I think it's better not have a class or id by default.
Just set the id or class when you need one.

Now when I don't need an id, I can't remove it. The html looks really ugly with an useless id property on the nav tag ;)

Thanks in advance for your new update ๐Ÿ‘ฏ

Custom Node Class Not Showing UP

I am having trouble getting the custom node class to work.

I have added a custom node class to a menu item via the CP. However, it does NOT show up on the menu. Here is the code that I am using:

{% set nav = craft.amNav.getNavRaw("top_header") %}

{% macro addNodeToNavigation(node) %}
    <li{% if node.active %} class="current"{% endif %}>
        <a href="{{ node.url }}" title="{{ node.name }}"><div>{{ node.name }}</div></a>
        {% if node.hasChildren %}
            <ul>
                {% for subnode in node.children %}
                    {{ _self.addNodeToNavigation(subnode) }}
                {% endfor %}
            </ul>
        {% endif %}
    </li>
{% endmacro %}

<ul>
    {% for node in nav %}
        {{ _self.addNodeToNavigation(node) }}
    {% endfor %}
</ul>

Any idea why it is not working?

Thanks,

Moshe

AmNav causes an error while trying to use yiic

While trying to use yiic(eg. to create a migration) AmNav produces the following error.

Fatal error: Call to a member function getCommand() on a non-object in /home/frank/Sites/xxxxx.xx/website/craft/app/etc/console/ConsoleApp.php on line 146

Call Stack:
    0.0001     233456   1. {main}() /home/frank/Sites/xxxxx.xx/website/craft/app/etc/console/yiic:0
    0.0003     258528   2. require_once('/home/frank/Sites/xxxxx.xx/website/craft/app/etc/console/yiic.php') /home/frank/Sites/xxxxx.xx/website/craft/app/etc/console/yiic:4
    0.0140    1898568   3. YiiBase::createApplication() /home/frank/Sites/xxxxx.xx/website/craft/app/etc/console/yiic.php:69
    0.0141    1900200   4. CApplication->__construct() /home/frank/Sites/xxxxx.xx/website/craft/app/framework/YiiBase.php:121
    0.0162    2159512   5. Craft\ConsoleApp->init() /home/frank/Sites/xxxxx.xx/website/craft/app/framework/base/CApplication.php:165
    0.0653    6220952   6. Craft\PluginsService->loadPlugins() /home/frank/Sites/xxxxx.xx/website/craft/app/etc/console/ConsoleApp.php:77
    0.0935    7525944   7. Craft\AmNavPlugin->init() /home/frank/Sites/xxxxx.xx/website/craft/app/services/PluginsService.php:138
    0.0935    7526496   8. Craft\ConsoleApp->on() /home/frank/Sites/craft-plugins2/amnav/1.1.8/AmNavPlugin.php:78

Add composer support

You can add composer support by adding a composer.json with the following contents:

{
    "name": "am-impact/amnav",
    "description": "Navigation Plugin for Craft",
    "authors": [
        {
            "name": "Hubert Prein",
            "email": "[email protected]"
        }
    ],
    "type": "craft-plugin",
    "require": {
        "composer/installers": "~1.0"
    }
}

Then you can submit your repo to Packagist. GitHub offers automatic packagist updating when you release a new version.

Feature Request | Breadcrumb from created navigation.

Hello, loving A&M Nav!

Currently breadcrumbs are built from the URL segments, this leads to breadcrumbs that don't reflect the navigation hierarchy which we display to the visitor.

I'm having to duplicate entries (and add the duplicate to my amnav) to ensure we echo the the site structure we are displaying to the visitor.

(...and thanks for creating AMNav)

general question

Decided to try a&m navigation using this in my template: {{ craft.amNav.getNav("fomenu", { classActive: "active" }) }} ... but not getting the active class showing up. What am I missing?

thanks

"New order saved" after saving nav

In /craft/plugins/amnav/resources/js/AmNav.js
Line 481 is hardcoded to always say "New order saved" after any save of the navigation menu. This should probably be changed to "Navigation saved".

Own Urls are not displayed.

I've created a navigation and added my own url but when I try to use it, it is not being displayed. I have used both craft.amNav.getNavRaw() and craft.amNav.getNav() but in neither case the own url shows up. Everything else works fine.

On the admin side, I can see the node and edit it. I'm on 1.5.1 version.

Use Global Variables?

Just wondering if it would be possible to use a global variable in the nav structure?

For example - working on a site that has links to a few 3rd party services, I am storing these url's as Craft Globals for use throughout the site (some content specific CTA's etc). I would like to be able to create utility navigation for the header/footer that includes these global urls without 'hard coding' the url a second time and relying on the global var to control the items URL.

Right now the Global/Twig variable is saved as a string and never parsed. (< a href="{{ global.myUrl }}">Link to service</ a> is output - no spaces in actual output ;) )

Need a page.first conditional

It would be awesome if there were a way to conditionally use page.first with craft.amNav.getNavRaw as with page.active :

{% if page.active %}class="active"{% endif %}

Like this:

{% if page.first %}class="first"{% endif %}

I have a situation where top level dropdowns must have javascript:void(0) hrefs and there does not seem to be a way to assign the top level as being the active branch. If were able to use page.first then I could assign the active styles to that class and bypass not being able to tell if the menu is active based on the URL location.

{% if page.hasActiveChild %}class="active"{% endif %}

Would be even better for complex menus.

Nav path active highlighting

I've built a menu with two levels of nav. One of them is Knowledge Base -> Blog. When on blog, both levels are marked as active, but when you click on a blog post (not in the menu) that active highlighting is missing. Any idea on how i can retain the active path in the menu in this scenario?

I'm using just the a&m tag to output the markup, i tried customising it, but i couldn't get the custom markup to work the same as the output from the tag alone.

Thanks!

John

Is there a method for getting ancestors of an entry?

On crafts documentation, they recommend this method for outputting a breadcrumbs for a structure.

{% if entry.level > 1 %}
    <ul class="crumbs">
        {% for crumb in entry.getAncestors() %}
            <li>{{ crumb.getLink() }}</li>
        {% endfor %}
    </ul>
{% endif %}

I'd like to use amnav for the flexibility of not having to work within a structure. However, I need to be able to produce breadcrumbs from the navigation.

active class not being applied to custom url

I have 2 sub menu items. One is an Existing Entry. The other is a My Own URL.

My page template has in the sidebar the sub menu items. So the code in the sidebar template looks like:

{{ craft.amNav.getNav("mainNavigation", { class: 'sub_nav', startFromId: 2 }) }}

I believe the issue is how the plugin is reading the URL.

If I put in as the custom URL: /about/staff - then it does NOT work (active class is not assigned).
If I put in as the custom URL: about/staff - then it DOES work (active class IS assigned)

The problem is, if I leave off that first forward slash in the URL, then the links get screwed up.
If I'm already on http://craft.dev/about/staff and click the link when it is set as about/staff, then I'm brought to a 404 page as it tries to find: http://craft.dev/about/about/staff

Variable "menus" does not exist

Upon brand new install. I received this error.

/Applications/MAMP/htdocs/cota2/craft/plugins/amnav/templates/_index.twig(17)
17 <div id="nonavigations"{% if navigations %} class="hidden"{% endif %}> 18 <p>{{ 'There are no navigations yet.'|t }}</p> 19 </div>

Level 1 in the header and level 2...3..4 in sidebar

I can display the level 1 of my menu in the header but I can't/don't know how to display the level 2, level 3... from the (active)level 1 in a sidebar.

In my header I have:

    {{ craft.amNav.getNav("mainMenu", { maxLevel: '1', classActive: 'active', excludeUl: '1' }) }}

How do I get the level 2, level 3 from (active)level 1 in a sidebar? In your parameters I see this one: startFromId but I think I should need something like this: startFromLevel.

Sorry for my poor english.
Francois

Install instructions

Hi,

I managed to install it by just renaming the downloaded folder to amnav from amnav-master that the downloaded compressed opened up to.
It would be useful to mention this in the read me.

thanks,
Csaba

Feature Request - Asset Menu Select

Rather than having to cut and paste the URL into a manual field - being able to create a menu item and link to document in Assets would be handy. Saves seconds, but handy!

update url & set `.active` with `#target` on one page scroller

I have a one page scrolling site where the nav items are using #ID target links. As of now, clicking the nav items scrolls to the correct #ID but the url is not reflected and the .active class is not set.

example markup

<li class="first">
    <a href="#about" title="About">About</a>
</li>

When the above "About" nav item is clicked I would like it to produce this url http://example.com/#about as well as set the <li> to .active.

Is the currently an option?

A&M adds the domain double to the nav

When using A&M (version 1.4.2 ) in its standard config with Craft (version 2.3.2641) the domain is links are doubled in the URL.

{# A&M NAV PLUGIN NAVIGATION #} <nav class="header-col main-nav"> <a href="#" class="nav-toggle"></a> {{ craft.amNav.getNav("mainNavigation") }} </nav>

This is what I would expect for a link to the entry "page": http://www.domain.com/page.html
and this is what the plugin renders after clicking the link: http://www.domain.com/http://www.domain.com/page.html

Hide disabled entries

If an entry is added to a menu, but is disabled (that is, turned off), it should be hidden from navigation.

Migrations failing

Howdy,

I went to updated to 1.6.3 from 1.4.2 and received this error in the log:

2015/05/26 16:35:08 [error] [application] Failed to apply migration: m150403_093000_AmNav_nodesWithElements (time: 0.003s)
2015/05/26 16:35:08 [error] [application] Migration failed for plugin AmNav. All later AmNav migrations are canceled.

Any ideas?

Best,
Dan

Relative vs Absolute URLs

Just a quick heads up. I have noticed an issue in respect to entering custom urls as to whether they should be input relatively or absolutely.

For example if I enter a custom item with the url "app/test" and output the nav on the /app page I will receive the url app/app/test. This is not a problem as I understand this gives flexibility however issues do arise when using things like the .active parameter.

So in my example I have now added the url as a full path "/app/test", so that there are no issues on sub pages but when the comparison happens to see if a url is active (AmNavService.php:_isPageActive:315) craft()->request->getPath() returns "app/test" and the code compares it to "/app/test" therefore no match found.

There are a few ways to get round this but just thought I would try and be helpful and bring it to your attention.

Keep up the good work!

Add 'parentUrl' functionality

I was looking for a way for my blog entries to make their parent pages 'active' in the navigation (eg my blog listing page).

I added a new 'parentUrl' parameter which is then put to use in the _isPageActive function in AmNavService.php.

First couple of lines are changed to as follows:

$path = $this->_getParam('parentUrl', craft()->request->getPath());
$segments = $this->_getParam('parentUrl', false) ? explode("/",$this->_getParam('parentUrl', false)) : craft()->request->getSegments();

And then it's used like so:

{{ craft.amNav.getNav("primaryNavigation", { classFirst: 'first', maxLevel: 2, excludeUl: true, classActive: 'active', parentUrl: 'support-resources/blog' }) }}

I was hoping you could add this as a proper feature, with probably a better name than parentUrl.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.