Implements new admin menu structure #304

close #305
This commit is contained in:
Chrisbr 2014-09-30 12:57:56 +02:00
parent 9e499d2a5e
commit be68877f1a
3 changed files with 82 additions and 120 deletions

View file

@ -100,31 +100,6 @@ $(function () {
$(".user-details-popover").popover();
$("#comments-div").hide();
$(document).ready(function () {
var path = window.location.pathname;
$(".myAccordion ul").each(function () {
$this = $(this);
$this.find("a").each(function () {
if ($(this).attr("href") == path) {
$this.show();
}
})
});
});
$( ".myAccordion" ).mouseover(function() {
if(!$(this).find("ul").is(':visible')){
//Hide all except this
$siblings = $(this).siblings().find("ul:visible");
$siblings.hide();
$siblings.parent().find('span:nth-child(2)').toggleClass("fa-chevron-down fa-chevron-right");
//show this
$(this).find("ul").show();
$(this).find('span:nth-child(2)').toggleClass("fa-chevron-down fa-chevron-right");
}
});
$('a:contains("Add track")').click(function () {
setTimeout(function () {
$("div.nested-fields:last div:nth-of-type(2) input").val(get_color());

View file

@ -35,109 +35,96 @@
%ul
- if can? :update, Contact.new(conference_id: @conference.id)
%li{:class=> "#{active_nav_li(edit_admin_conference_contact_path(@conference.short_title))}"}
= link_to(edit_admin_conference_contact_path(@conference.short_title)) do
%span.fa.fa-envelope-o
Contact
= link_to 'Contact', edit_admin_conference_contact_path(@conference.short_title)
- if can? :index, @conference.commercials.build
%li{:class=> "#{active_nav_li(admin_conference_commercials_path(@conference.short_title))}"}
= link_to(admin_conference_commercials_path(@conference.short_title)) do
%span.fa.fa-film
Commercials
= link_to 'Commercials', admin_conference_commercials_path(@conference.short_title)
- if can? :update, @conference.photos.build
%li{:class=> "#{active_nav_li(admin_conference_photos_path(@conference.short_title))}"}
= link_to(admin_conference_photos_path(@conference.short_title)) do
%span.fa.fa-picture-o
Photos
- if can? :update, @conference
%li{:class=> active_nav_li( admin_conference_registration_period_path (@conference.short_title))}
= link_to( admin_conference_registration_period_path (@conference.short_title)) do
%span.fa.fa-male
Registration Period
- if can? :update, @conference
%li{:class=> active_nav_li( admin_conference_splashpage_path (@conference.short_title))}
= link_to( admin_conference_splashpage_path (@conference.short_title)) do
%span.fa.fa-globe
Splashpage
- if can? :update, @conference.events.build
%li{:class=> active_nav_li(admin_conference_events_path(@conference.short_title))}
= link_to(admin_conference_events_path(@conference.short_title)) do
%span.fa.fa-comment
Events
- if can? :update, Registration.new(conference_id: @conference.id)
%li{:class=> active_nav_li(admin_conference_registrations_path(@conference.short_title))}
= link_to(admin_conference_registrations_path(@conference.short_title)) do
%span.fa.fa-user
Registrations
- if can? :update, @conference.events.build
%li{class: active_nav_li(admin_conference_schedule_path(@conference.short_title))}
= link_to(admin_conference_schedule_path(@conference.short_title), target: '_blank') do
%span.fa.fa-calendar
Schedule
- if can? :update, @conference
%li{class: active_nav_li(admin_conference_campaigns_path(@conference.short_title))}
= link_to(admin_conference_campaigns_path(@conference.short_title)) do
%span.fa.fa-bullhorn
Campaigns
%hr
- if can? :update, @conference.targets.build
%li{:class=> "#{active_nav_li(admin_conference_targets_path(@conference.short_title))}"}
= link_to(admin_conference_targets_path(@conference.short_title)) do
%span.fa.fa-flag
Targets
= link_to 'Photos', admin_conference_photos_path(@conference.short_title)
- if can? :update, @conference
%li{:class=> active_nav_li(admin_conference_splashpage_path(@conference.short_title))}
= link_to 'Splashpage', admin_conference_splashpage_path(@conference.short_title)
- if can? :index, @conference.venue
%li{:class=> "#{active_nav_li(admin_conference_venue_info_path(@conference.short_title))} myAccordion"}
%li{:class=> "#{active_nav_li(admin_conference_venue_info_path(@conference.short_title))}"}
= link_to(admin_conference_venue_info_path(@conference.short_title)) do
%span.fa.fa-road
Venue
%span.small.fa.fa-chevron-right
%ul.nav.nav-stacked.nav-pills.small.collapse.subNav
%ul
- if can? :update, @conference.rooms.build
%li{:class=> active_nav_li(admin_conference_rooms_path(@conference.short_title))}
= link_to 'Rooms', admin_conference_rooms_path(@conference.short_title)
- if can? :update, @conference.venue.lodgings.build
%li{ class: active_nav_li(admin_conference_lodgings_path(@conference.short_title)) }
= link_to 'Lodgings', admin_conference_lodgings_path(@conference.short_title)
- if can? :update, @conference.sponsorship_levels.build
%li{:class=> "#{active_nav_li(admin_conference_sponsorship_levels_path(@conference.short_title))} myAccordion" }
= link_to(admin_conference_sponsorship_levels_path(@conference.short_title)) do
%span.fa.fa-star
Sponsorship
%span.small.fa.fa-chevron-right
%ul.nav.nav-stacked.nav-pills.small.collapse.subNav
- if can? :update, @conference.sponsors.build
%li{:class=> active_nav_li(admin_conference_sponsors_path(@conference.short_title))}
= link_to 'Sponsors', admin_conference_sponsors_path(@conference.short_title)
- if can? :update, @conference.tickets.build
%li{ class: active_nav_li(admin_conference_tickets_path(@conference.short_title)) }
= link_to(admin_conference_tickets_path(@conference.short_title)) do
%span.fa.fa-usd
Tickets
- if can? :update, @conference.email_settings
%li{:class=> active_nav_li(admin_conference_emails_path(@conference.short_title))}
= link_to(admin_conference_emails_path(@conference.short_title)) do
%span.fa.fa-envelope
E-Mails
- if can? :update, CallForPapers.new(conference_id: @conference.id)
%li{:class=> "#{active_nav_li(admin_conference_callforpapers_path(@conference.short_title))} myAccordion"}
= link_to(admin_conference_callforpapers_path(@conference.short_title)) do
%span.fa.fa-comment
Call for papers
%span.small.fa.fa-chevron-right
%ul.nav.nav-stacked.nav-pills.small.collapse.subNav
%li
%a
%span.fa.fa-calendar
Program
%ul
- if can? :update, @conference.events.build
%li{:class=> active_nav_li(admin_conference_events_path(@conference.short_title))}
= link_to 'Events', admin_conference_events_path(@conference.short_title)
- if can? :update, CallForPapers.new(conference_id: @conference.id)
%li{:class=> "#{active_nav_li(admin_conference_callforpapers_path(@conference.short_title))}"}
= link_to 'Call for Papers', admin_conference_callforpapers_path(@conference.short_title)
- if can? :update, @conference.tracks.build
%li{:class=> active_nav_li(admin_conference_tracks_path(@conference.short_title))}
= link_to 'Tracks', admin_conference_tracks_path(@conference.short_title)
- if can? :update, @conference.event_types.build
%li{:class=> active_nav_li(admin_conference_event_types_path(@conference.short_title))}
= link_to 'Event types', admin_conference_event_types_path(@conference.short_title)
= link_to 'Event Types', admin_conference_event_types_path(@conference.short_title)
- if can? :update, @conference.difficulty_levels.build, conference_id: @conference.id
%li{:class=> active_nav_li(admin_conference_difficulty_levels_path(@conference.short_title))}
= link_to 'Difficulty levels', admin_conference_difficulty_levels_path(@conference.short_title)
- if can? :update, Question.new(conference_id: @conference.id)
%li{:class=> active_nav_li(admin_conference_questions_path(@conference.short_title))}
= link_to(admin_conference_questions_path(@conference.short_title)) do
%span.fa.fa-question
Questions
= link_to 'Difficulty Levels', admin_conference_difficulty_levels_path(@conference.short_title)
- if can? :update, @conference.events.build
%li{class: active_nav_li(admin_conference_schedule_path(@conference.short_title))}
= link_to 'Schedule', admin_conference_schedule_path(@conference.short_title), target: '_blank'
- if can? :update, Registration.new(conference_id: @conference.id)
%li{:class=> active_nav_li(admin_conference_registrations_path(@conference.short_title))}
= link_to(admin_conference_registrations_path(@conference.short_title)) do
%span.fa.fa-user
Registrations
%ul
- if can? :update, @conference
%li{:class=> active_nav_li(admin_conference_registration_period_path(@conference.short_title))}
= link_to 'Registration Period', admin_conference_registration_period_path(@conference.short_title)
- if can? :update, Question.new(conference_id: @conference.id)
%li{:class=> active_nav_li(admin_conference_questions_path(@conference.short_title))}
= link_to 'Questions', admin_conference_questions_path(@conference.short_title)
%li
%a
%span.fa.fa-usd
Donations
%ul
- if can? :update, @conference.sponsorship_levels.build
%li{:class=> "#{active_nav_li(admin_conference_sponsorship_levels_path(@conference.short_title))}" }
= link_to 'Sponsorship', admin_conference_sponsorship_levels_path(@conference.short_title)
- if can? :update, @conference.sponsors.build
%li{:class=> active_nav_li(admin_conference_sponsors_path(@conference.short_title))}
= link_to 'Sponsors', admin_conference_sponsors_path(@conference.short_title)
- if can? :update, @conference.tickets.build
%li{ class: active_nav_li(admin_conference_tickets_path(@conference.short_title)) }
= link_to 'Tickets', admin_conference_tickets_path(@conference.short_title)
%li
%a
%span.fa.fa-money
Objectives
%ul
- if can? :update, @conference
%li{class: active_nav_li(admin_conference_campaigns_path(@conference.short_title))}
= link_to 'Campaigns', admin_conference_campaigns_path(@conference.short_title)
- if can? :update, @conference.targets.build
%li{:class=> "#{active_nav_li(admin_conference_targets_path(@conference.short_title))}"}
= link_to 'Goals', admin_conference_targets_path(@conference.short_title)
- if can? :update, @conference.email_settings
%li{:class=> active_nav_li(admin_conference_emails_path(@conference.short_title))}
= link_to(admin_conference_emails_path(@conference.short_title)) do
%span.fa.fa-envelope
E-Mails
- if can? :manage, @conference
%li{:class=> active_nav_li(roles_admin_conference_path(@conference.short_title))}
= link_to 'Roles', roles_admin_conference_path(@conference.short_title)
= link_to(roles_admin_conference_path(@conference.short_title)) do
%span.fa.fa-group
Roles

View file

@ -28,7 +28,7 @@ feature 'Has correct abilities' do
expect(page).to have_link('Registrations', href: "/admin/conference/#{conference1.short_title}/registrations")
expect(page).to have_link('Schedule', href: "/admin/conference/#{conference1.short_title}/schedule")
expect(page).to have_link('Campaigns', href: "/admin/conference/#{conference1.short_title}/campaigns")
expect(page).to have_link('Targets', href: "/admin/conference/#{conference1.short_title}/targets")
expect(page).to have_link('Goals', href: "/admin/conference/#{conference1.short_title}/targets")
expect(page).to have_link('Venue', href: "/admin/conference/#{conference1.short_title}/venue")
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference1.short_title}/rooms")
expect(page).to have_link('Lodgings', href: "/admin/conference/#{conference1.short_title}/lodgings")
@ -36,10 +36,10 @@ feature 'Has correct abilities' do
expect(page).to have_link('Sponsors', href: "/admin/conference/#{conference1.short_title}/sponsors")
expect(page).to have_link('Tickets', href: "/admin/conference/#{conference1.short_title}/tickets")
expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference1.short_title}/emails")
expect(page).to have_link('Call for papers', href: "/admin/conference/#{conference1.short_title}/callforpapers")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference1.short_title}/callforpapers")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference1.short_title}/tracks")
expect(page).to have_link('Event types', href: "/admin/conference/#{conference1.short_title}/event_types")
expect(page).to have_link('Difficulty levels', href: "/admin/conference/#{conference1.short_title}/difficulty_levels")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference1.short_title}/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference1.short_title}/difficulty_levels")
expect(page).to have_link('Questions', href: "/admin/conference/#{conference1.short_title}/questions")
expect(page).to have_link('Roles', href: "/admin/conference/#{conference1.short_title}/roles")
@ -99,7 +99,7 @@ feature 'Has correct abilities' do
expect(page).to_not have_link('Registrations', href: "/admin/conference/#{conference2.short_title}/registrations")
expect(page).to have_link('Schedule', href: "/admin/conference/#{conference2.short_title}/schedule")
expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference2.short_title}/campaigns")
expect(page).to_not have_link('Targets', href: "/admin/conference/#{conference2.short_title}/targets")
expect(page).to_not have_link('Goals', href: "/admin/conference/#{conference2.short_title}/targets")
expect(page).to have_link('Venue', href: "/admin/conference/#{conference2.short_title}/venue")
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference2.short_title}/rooms")
expect(page).to_not have_link('Lodgings', href: "/admin/conference/#{conference2.short_title}/lodgings")
@ -107,10 +107,10 @@ feature 'Has correct abilities' do
expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference2.short_title}/sponsors")
expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference2.short_title}/supporter_levels")
expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference2.short_title}/emails")
expect(page).to have_link('Call for papers', href: "/admin/conference/#{conference2.short_title}/callforpapers")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference2.short_title}/callforpapers")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference2.short_title}/tracks")
expect(page).to have_link('Event types', href: "/admin/conference/#{conference2.short_title}/event_types")
expect(page).to have_link('Difficulty levels', href: "/admin/conference/#{conference2.short_title}/difficulty_levels")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference2.short_title}/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference2.short_title}/difficulty_levels")
expect(page).to_not have_link('Questions', href: "/admin/conference/#{conference2.short_title}/questions")
expect(page).to_not have_link('Roles', href: "/admin/conference/#{conference2.short_title}/roles")
@ -242,7 +242,7 @@ feature 'Has correct abilities' do
expect(page).to_not have_link('Registrations', href: "/admin/conference/#{conference4.short_title}/registrations")
expect(page).to_not have_link('Schedule', href: "/admin/conference/#{conference4.short_title}/schedule")
expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference4.short_title}/campaigns")
expect(page).to_not have_link('Targets', href: "/admin/conference/#{conference4.short_title}/targets")
expect(page).to_not have_link('Goals', href: "/admin/conference/#{conference4.short_title}/targets")
expect(page).to_not have_link('Venue', href: "/admin/conference/#{conference4.short_title}/venue")
expect(page).to_not have_link('Rooms', href: "/admin/conference/#{conference4.short_title}/rooms")
expect(page).to_not have_link('Lodgings', href: "/admin/conference/#{conference4.short_title}/lodgings")
@ -250,10 +250,10 @@ feature 'Has correct abilities' do
expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference4.short_title}/sponsors")
expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference4.short_title}/supporter_levels")
expect(page).to_not have_link('E-Mails', href: "/admin/conference/#{conference4.short_title}/emails")
expect(page).to_not have_link('Call for papers', href: "/admin/conference/#{conference4.short_title}/callforpapers")
expect(page).to_not have_link('Call for Papers', href: "/admin/conference/#{conference4.short_title}/callforpapers")
expect(page).to_not have_link('Tracks', href: "/admin/conference/#{conference4.short_title}/tracks")
expect(page).to_not have_link('Event types', href: "/admin/conference/#{conference4.short_title}/event_types")
expect(page).to_not have_link('Difficulty levels', href: "/admin/conference/#{conference4.short_title}/difficulty_levels")
expect(page).to_not have_link('Event Types', href: "/admin/conference/#{conference4.short_title}/event_types")
expect(page).to_not have_link('Difficulty Levels', href: "/admin/conference/#{conference4.short_title}/difficulty_levels")
expect(page).to_not have_link('Questions', href: "/admin/conference/#{conference4.short_title}/questions")
expect(page).to_not have_link('Roles', href: "/admin/conference/#{conference4.short_title}/roles")