Nicolae Claudius
13 years ago
8 changed files with 133 additions and 92 deletions
@ -1,8 +1,8 @@
|
||||
<ul class="nav nav-pills"> |
||||
<li><%= link_to "Sign in", new_session_path(resource_name) %></li> |
||||
<li><%= link_to "Sign up", new_registration_path(resource_name) %><br /></li> |
||||
<li><%= link_to "Forgot your password?", new_password_path(resource_name) %></li> |
||||
<li><%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %></li> |
||||
<li><%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %></li> |
||||
</ul> |
||||
<% semantic_navigation :devise_nav, html: { class: 'nav nav-pills pjax-nav' } do |n| %> |
||||
<%= n.item "Sign in", link: new_session_path(resource_name) %> |
||||
<%= n.item "Sign up", link: new_registration_path(resource_name) %> |
||||
<%= n.item "Forgot your password?", link: new_password_path(resource_name) %> |
||||
<%= n.item "Didn't receive confirmation instructions?", link: new_confirmation_path(resource_name) %> |
||||
<%= n.item "Didn't receive unlock instructions?", link: new_unlock_path(resource_name) %> |
||||
<% end %> |
||||
|
||||
|
@ -1,51 +1,34 @@
|
||||
<ul class="nav"> |
||||
<li><%#= link_to('Dashboard', dashboard_path, :data => {:pjax => '#main'}) %></li> |
||||
<li> |
||||
<%= link_to domains_path, data: {pjax: '#main'} do %> |
||||
<% semantic_navigation :application_nav, html: { class: 'nav pjax-nav' } do |n| %> |
||||
<%#= link_to('Dashboard', dashboard_path, :data => {:pjax => '#main'}) %> |
||||
<%= n.item '', link: domains_path do %> |
||||
<i class="icon-white icon-th-list"></i> My Domains |
||||
<% end %> |
||||
</li> |
||||
<li> |
||||
<%= link_to hosts_path, data: {pjax: '#main'} do %> |
||||
<%= n.item '', link: hosts_path do %> |
||||
<i class="icon-white icon-th"></i> Dynamic Hosts |
||||
<% end %> |
||||
</li> |
||||
<li> |
||||
<%= link_to(page_path('help'), data: {pjax: '#main'}) do %> |
||||
<%= n.item '', link: page_path('help') do %> |
||||
<i class="icon-white icon-question-sign"></i> Help & Support |
||||
<% end %> |
||||
</li> |
||||
</ul> |
||||
<% end %> |
||||
|
||||
<ul class="nav pull-right"> |
||||
<li> |
||||
<%= link_to(Settings.news_link, rel: 'tooltip', title: Settings.news_link) do %> |
||||
<% semantic_navigation :user_nav, html: { class: 'nav pull-right pjax-nav' } do |n| %> |
||||
<%= n.item '', link: Settings.news_link, html: { rel: 'tooltip', title: Settings.news_link } do %> |
||||
<i class="icon-white icon-share-alt"></i> News |
||||
<% end %> |
||||
</li> |
||||
<li> |
||||
<%= link_to(page_path('donate'), rel: 'tooltip', title: 'PayPal', |
||||
class: 'highlight', data: {pjax: '#main'}) do %> |
||||
<%= n.item '', link: page_path('donate'), html: { rel: 'tooltip', title: 'PayPal', class: 'highlight' } do %> |
||||
<i class="icon-white icon-heart"></i> Donate |
||||
<% end %> |
||||
</li> |
||||
|
||||
<li class="dropdown"> |
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> |
||||
<i class="icon-white icon-user"></i> <%= current_user.email %> <b class="caret"></b> |
||||
</a> |
||||
|
||||
<ul class="dropdown-menu"> |
||||
<li> |
||||
<%= link_to(edit_user_registration_path, rel: 'tooltip', |
||||
:title => "IP: #{client_remote_ip}", data: {pjax: '#main'}) do %> |
||||
<%= n.group do %> |
||||
<%= n.item '', link: edit_user_registration_path, html: { rel: 'tooltip', title: "IP: #{client_remote_ip}" } do %> |
||||
<i class="icon-cog"></i> Settings |
||||
<% end %> |
||||
</li> |
||||
<li> |
||||
<%= link_to(destroy_user_session_path, method: :delete) do %> |
||||
<%= n.item '', link: destroy_user_session_path, link_html: { data: { :'skip-pjax' => true } } do %> |
||||
<i class="icon-off"></i> Sign out |
||||
<% end %> |
||||
<% end %> |
||||
</li> |
||||
</ul> |
||||
</ul> |
||||
<% end %> |
||||
|
@ -1,32 +1,21 @@
|
||||
<ul class="nav"> |
||||
<li><%= link_to('About', page_path('about'), data: {pjax: '#main'}) %></li> |
||||
<li><%= link_to('Team', page_path('team'), data: {pjax: '#main'}) %></li> |
||||
<li><%= link_to('Contact', page_path('contact'), data: {pjax: '#main'}) %></li> |
||||
<li><%= link_to('Help & Support', page_path('help'), data: {pjax: '#main'}) %></li> |
||||
</ul> |
||||
<% semantic_navigation :public_nav, html: { class: 'nav pjax-nav' } do |n| %> |
||||
<%= n.item 'About', link: page_path('about') %> |
||||
<%= n.item 'Team', link: page_path('team') %> |
||||
<%= n.item 'Contact', link: page_path('contact') %> |
||||
<%= n.item 'Help & Support', link: page_path('help') %> |
||||
<% end %> |
||||
|
||||
<ul class="nav pull-right"> |
||||
<li> |
||||
<%= link_to(Settings.news_link, rel: 'tooltip', title: Settings.news_link) do %> |
||||
<% semantic_navigation :session_nav, html: { class: 'nav pull-right pjax-nav' } do |n| %> |
||||
<%= n.item '', link: Settings.news_link, html: { rel: 'tooltip', title: Settings.news_link } do %> |
||||
<i class="icon-white icon-share-alt"></i> News |
||||
<% end %> |
||||
</li> |
||||
<li> |
||||
<%= link_to(page_path('donate'), rel: 'tooltip', title: 'PayPal', |
||||
class: 'highlight', data: {pjax: '#main'}) do %> |
||||
<%= n.item '', link: page_path('donate'), html: { rel: 'tooltip', title: 'PayPal', class: 'highlight' } do %> |
||||
<i class="icon-white icon-heart"></i> Donate |
||||
<% end %> |
||||
</li> |
||||
|
||||
<li> |
||||
<%= link_to(new_user_registration_path, data: {pjax: '#main'}) do %> |
||||
<%= n.item '', link: new_user_registration_path do %> |
||||
<i class="icon-white icon-arrow-up"></i> Sign up |
||||
<% end %> |
||||
</li> |
||||
<li> |
||||
<%= link_to(new_user_session_path, data: {pjax: '#main'}) do %> |
||||
<%= n.item '', link: new_user_session_path do %> |
||||
<i class="icon-white icon-arrow-right"></i> Sign in |
||||
<% end %> |
||||
</li> |
||||
|
||||
</ul> |
||||
<% end %> |
||||
|
@ -0,0 +1,42 @@
|
||||
Navigasmic.setup do |config| |
||||
config.highlighted_class = 'active' |
||||
config.with_group_class = 'dropdown-menu' |
||||
end |
||||
|
||||
module Navigasmic |
||||
# lazy monkey patch, makes it work with twitter bootstrap |
||||
class HtmlNavigationBuilder |
||||
|
||||
def item(label = '', options = {}, &proc) |
||||
buffer = block_given? ? template.capture(self, &proc) : '' |
||||
label = (label + buffer).html_safe |
||||
|
||||
item = NavigationItem.new(label, options, template) |
||||
|
||||
options[:html] ||= {} |
||||
options[:html][:class] = template.add_html_class(options[:html][:class], Navigasmic.disabled_class) if item.disabled? |
||||
options[:html][:class] = template.add_html_class(options[:html][:class], Navigasmic.highlighted_class) if item.highlighted?(template.request.path, template.params, template) |
||||
|
||||
label = label_for_item(label) |
||||
link = item.link.is_a?(Proc) ? template.instance_eval(&item.link) : item.link |
||||
|
||||
label = template.link_to(label, link, options.delete(:link_html)) unless !item.link? || item.disabled? |
||||
|
||||
item.hidden? ? '' : template.content_tag(Navigasmic.item_tag, label, options.delete(:html)) |
||||
end |
||||
|
||||
def group(options = {}, &proc) |
||||
raise ArgumentError, "Missing block" unless block_given? |
||||
|
||||
options[:html] ||= {} |
||||
options[:html][:class] = template.add_html_class(options[:html][:class], Navigasmic.with_group_class) |
||||
|
||||
buffer = template.capture(self, &proc) |
||||
group = template.content_tag(Navigasmic.group_tag, buffer, options.delete(:html)) |
||||
|
||||
visible = options[:hidden_unless].nil? ? true : options[:hidden_unless].is_a?(Proc) ? template.instance_eval(&options[:hidden_unless]) : options[:hidden_unless] |
||||
visible ? group.html_safe : '' |
||||
end |
||||
|
||||
end |
||||
end |
Loading…
Reference in new issue