Simplify sidebar and navigation

Check existence of supporter levels
This commit is contained in:
Henne Vogelsang 2014-03-04 10:10:07 +01:00
parent 59933115fc
commit 0982be8579
21 changed files with 93 additions and 169 deletions

View file

@ -1,4 +1,13 @@
module ApplicationHelper
def active_nav_li(link)
if current_page?(link)
return 'active'
else
return ''
end
end
def getdatetime(registration, field)
if registration.send(field.to_sym).kind_of?(String)
DateTime.parse(registration.send(field.to_sym)).strftime("%d %b %H:%M") if registration.send(field.to_sym)

View file

@ -1,7 +1,7 @@
.container-fluid
.row-fluid
.span3
= render 'admin/conference/sidebar', :activated => "Call for Papers"
= render 'admin/conference/sidebar'
.span9
= semantic_form_for(@cfp, :url => admin_conference_cfp_update_path(@conference.short_title),:html => {:multipart => true}) do |f|
= f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" }

View file

@ -3,55 +3,27 @@
%li.nav-header
=@conference.short_title
Settings
- if activated == "Conference"
%li.active= link_to "Conference", "#"
- else
%li= link_to "Conference", admin_conference_path(@conference.short_title)
- if activated == "Levels"
%li.active= link_to "Supporter Levels", "#"
- else
%li= link_to "Supporter Levels", admin_conference_supporter_levels_path(@conference.short_title)
- if activated == "Call for Papers"
%li.active= link_to "Call for Papers", "#"
- else
%li= link_to "Call for Papers", admin_conference_cfp_info_path(@conference.short_title)
- if activated == "Venue"
%li.active= link_to "Venue", "#"
- else
%li= link_to "Venue", admin_conference_venue_info_path(@conference.short_title)
- if activated == "Rooms"
%li.active= link_to "Rooms", "#"
- else
%li= link_to "Rooms", admin_conference_rooms_list_path(@conference.short_title)
- if activated == "Tracks"
%li.active= link_to "Tracks", "#"
- else
%li= link_to "Tracks", admin_conference_tracks_list_path(@conference.short_title)
- if activated == "Event Types"
%li.active= link_to "Event Types", "#"
- else
%li= link_to "Event Types", admin_conference_eventtype_list_path(@conference.short_title)
- if activated == "Difficulty Levels"
%li.active= link_to "Difficulty Levels", "#"
- else
%li= link_to "Difficulty Levels", admin_conference_difficulty_levels_path(@conference.short_title)
- if activated == "Social Events"
%li.active= link_to "Social Events", "#"
- else
%li= link_to "Social Events", admin_conference_social_events_path(@conference.short_title)
- if activated == "Emails"
%li.active= link_to "Emails", "#"
- else
%li= link_to "Emails", admin_conference_email_settings_path(@conference.short_title)
- if activated == "Diet"
%li.active= link_to "Dietary Choices", "#"
- else
%li= link_to "Dietary Choices", admin_conference_dietary_list_path(@conference.short_title)
- if activated == "Questions"
%li.active= link_to "Questions", "#"
- else
%li= link_to "Questions", admin_conference_questions_path(@conference.short_title)
- if activated == "volunteers"
%li.active= link_to "Volunteer Options", "#"
- else
%li= link_to "Volunteer Options", admin_conference_volunteer_options_path(@conference.short_title)
%li{:class=> active_nav_li(admin_conference_path(@conference.short_title))}
= link_to "Conference", admin_conference_path(@conference.short_title)
%li{:class=> active_nav_li(admin_conference_venue_info_path(@conference.short_title))}
= link_to "Venue", admin_conference_venue_info_path(@conference.short_title)
%li{:class=> active_nav_li(admin_conference_cfp_info_path(@conference.short_title))}
= link_to "Call for Papers", admin_conference_cfp_info_path(@conference.short_title)
%li{:class=> active_nav_li(admin_conference_rooms_list_path(@conference.short_title))}
= link_to "Rooms", admin_conference_rooms_list_path(@conference.short_title)
%li{:class=> active_nav_li(admin_conference_tracks_list_path(@conference.short_title))}
= link_to "Tracks", admin_conference_tracks_list_path(@conference.short_title)
%li{:class=> active_nav_li(admin_conference_eventtype_list_path(@conference.short_title))}
= link_to "Event Types", admin_conference_eventtype_list_path(@conference.short_title)
%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)
%li{:class=> active_nav_li(admin_conference_social_events_path(@conference.short_title))}
= link_to "Social Events", admin_conference_social_events_path(@conference.short_title)
%li{:class=> active_nav_li(admin_conference_supporter_levels_path(@conference.short_title))}
= link_to "Supporter Levels", admin_conference_supporter_levels_path(@conference.short_title)
%li{:class=> active_nav_li(admin_conference_email_settings_path(@conference.short_title))}
= link_to "Emails", admin_conference_email_settings_path(@conference.short_title)
%li{:class=> active_nav_li(admin_conference_questions_path(@conference.short_title))}
= link_to "Questions", admin_conference_questions_path(@conference.short_title)
%li{:class=> active_nav_li(admin_conference_volunteers_info_path(@conference.short_title))}
= link_to "Volunteers", admin_conference_volunteers_info_path(@conference.short_title)

View file

@ -1,7 +1,7 @@
.container-fluid
.row-fluid
.span3
= render 'admin/conference/sidebar', :activated => "Conference"
= render 'admin/conference/sidebar'
.span9
= semantic_form_for(@conference, :url => admin_conference_path(@conference.short_title),:html => {:multipart => true}) do |f|
= f.input :title, :hint => "The full name of the conference, such as 'OpenSUSE Conference 2013'"
@ -17,4 +17,4 @@
= image_tag @conference.logo(:thumb)
= f.input :logo, :label => "Conference Logo", :hint => "This will be displayed on the front page."
= f.input :html_export_path, :hint => "The path for static HTML exports"
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -1,9 +1,9 @@
.container-fluid
.row-fluid
.span3
= render 'admin/conference/sidebar', :activated => "Difficulty Levels"
= render 'admin/conference/sidebar'
.span9
= semantic_form_for(@conference, :url => admin_conference_difficulty_levels_path(@conference.short_title)) do |f|
= f.input :use_difficulty_levels, :label => false
= dynamic_association :difficulty_levels, "Difficulty_Levels", f
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -1,7 +1,7 @@
.container-fluid
.row-fluid
.span3
= render 'admin/conference/sidebar', :activated => "Emails"
= render 'admin/conference/sidebar'
.span9
= link_to "Template Help", "#", :id => "template-help-link"
#template-help
@ -47,4 +47,4 @@
$("#template-help-link").click(function() {
$("#template-help").toggle();
});
});
});

View file

@ -1,8 +1,8 @@
.container-fluid
.row-fluid
.span3
= render 'admin/conference/sidebar', :activated => "Event Types"
= render 'admin/conference/sidebar'
.span9
= semantic_form_for(@conference, :url => admin_conference_eventtype_update_path(@conference.short_title)) do |f|
= dynamic_association :event_types, "Event Types", f
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -1,7 +1,7 @@
.container-fluid
.row-fluid
.span3
= render 'admin/conference/sidebar', :activated => "Questions"
= render 'admin/conference/sidebar'
.span9
.pull-right
%b= link_to "Create New Question","#", "data-toggle" => "modal", "data-target" => "#new-question", :class => "btn btn-success"
@ -28,4 +28,4 @@
Save
.pull-right
%button{:class=> "btn btn-danger", "data-dismiss"=> "modal", "aria-hidden"=>"true"}
Cancel
Cancel

View file

@ -18,7 +18,7 @@
= p.text_field :company, :placeholder => "Company/User Group/nothing", :as => :string
= f.inputs "Registration Information" do
- if @conference.use_supporter_levels?
- if @conference.use_supporter_levels? and @conference.supporter_levels.length > 0
= f.semantic_fields_for :supporter_registration do |reg|
= reg.input :supporter_level, :as => :select, :collection => @conference.supporter_levels
= reg.input :code, :label => "Confirmation or registration code (if applicable)"
@ -35,11 +35,6 @@
%br
= f.input :social_events, :as => :check_boxes, :label => false, :collection => @conference.social_events
- if @conference.use_dietary_choices?
= f.inputs "Food" do
= f.input :dietary_choice, :collection => [["None", nil]] + @conference.dietary_choices.map {|x| [x.title, x.id]},
:include_blank => false, :label => "Special Dietary Restriction"
= f.input :other_dietary_choice, :input_html => {:rows => "2", :class => "span6"}, :label => "Other Dietary Restictions (please describe)"
= f.action :submit, :button_html => { :value => "Edit Registration", :class => "btn btn-primary" }
:javascript
$("#registration_supporter_registration_attributes_supporter_level_id").change(function () {
@ -69,4 +64,4 @@
onSelect: function(selected) {
$("#registration-arrival-datepicker").datepicker("option","maxDate", selected)
}
});
});

View file

@ -19,7 +19,7 @@
= p.text_field :company, :placeholder => "Company/User Group/nothing", :as => :string
= f.inputs "Registration Information" do
- if @conference.use_supporter_levels?
- if @conference.use_supporter_levels? and @conference.supporter_levels.length > 0
= f.semantic_fields_for @supporter_registration do |reg|
= reg.input :supporter_level, :as => :select, :collection => @conference.supporter_levels
= reg.input :code, :label => "Confirmation or registration code (if applicable)"
@ -36,11 +36,6 @@
%br
= f.input :social_events, :as => :check_boxes, :label => false, :collection => @conference.social_events
- if @conference.use_dietary_choices?
= f.inputs "Food" do
= f.input :dietary_choice, :collection => [["None", nil]] + @conference.dietary_choices.map {|x| [x.title, x.id]},
:include_blank => false, :label => "Special Dietary Restriction"
= f.input :other_dietary_choice, :input_html => {:rows => "2", :class => "span6"}, :label => "Other Dietary Restictions (please describe)"
= f.action :submit, :button_html => { :value => "Create", :class => "btn btn-primary"}
:javascript

View file

@ -1,8 +1,8 @@
.container-fluid
.row-fluid
.span3
= render 'admin/conference/sidebar', :activated => "Rooms"
= render 'admin/conference/sidebar'
.span9
= semantic_form_for(@conference, :url => admin_conference_rooms_update_path(@conference.short_title)) do |f|
= dynamic_association :rooms, "Rooms", f
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -1,8 +1,8 @@
.container-fluid
.row-fluid
.span3
= render 'admin/conference/sidebar', :activated => "Social Events"
= render 'admin/conference/sidebar'
.span9
= semantic_form_for(@conference, :url => admin_conference_social_events_path(@conference.short_title)) do |f|
= dynamic_association :social_events, "Social Events", f
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -1,9 +1,9 @@
.container-fluid
.row-fluid
.span3
= render 'admin/conference/sidebar', :activated => "Levels"
= render 'admin/conference/sidebar'
.span9
= semantic_form_for(@conference, :url => admin_conference_supporter_levels_path(@conference.short_title)) do |f|
= f.input :use_supporter_levels, :label => false
= dynamic_association :supporter_levels, "Supporter Levels", f
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -1,8 +1,8 @@
.container-fluid
.row-fluid
.span3
= render 'admin/conference/sidebar', :activated => "Tracks"
= render 'admin/conference/sidebar'
.span9
= semantic_form_for(@conference, :url => admin_conference_tracks_update_path(@conference.short_title)) do |f|
= dynamic_association :tracks, "Tracks", f
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -1,11 +1,11 @@
.container-fluid
.row-fluid
.span3
= render 'admin/conference/sidebar', :activated => "Venue"
= render 'admin/conference/sidebar'
.span9
= semantic_form_for(@venue, :url => admin_conference_venue_update_path(@conference.short_title),:html => {:multipart => true}) do |f|
= f.input :name, :input_html => {:rows => 1}
= f.input :address, :input_html => {:rows => 1}
= f.input :website
= f.input :description, :input_html => { :rows => 10, :cols => 20 }
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -1,9 +1,9 @@
.container-fluid
.row-fluid
.span3
= render 'admin/conference/sidebar', :activated => "Volunteers"
= render 'admin/conference/sidebar'
.span9
= semantic_form_for(@conference, :url => admin_conference_volunteer_options_update_path(@conference.short_title)) do |f|
= semantic_form_for(@conference, :url => admin_conference_volunteers_update_path(@conference.short_title)) do |f|
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
%br
%br
@ -12,4 +12,4 @@
= dynamic_association :vdays, "Volunteer Days", f
.span5
= f.input :use_vpositions, :label => false
= dynamic_association :vpositions, "Volunteer positions", f
= dynamic_association :vpositions, "Volunteer positions", f

View file

@ -16,7 +16,7 @@
%br
= f.fields_for :person do |p|
= p.text_field :public_name, :for => :person
- if @conference.use_supporter_levels?
- if @conference.use_supporter_levels? and @conference.supporter_levels.length > 0
= f.semantic_fields_for :supporter_registration do |reg|
= reg.input :supporter_level, :as => :select, :collection => @conference.supporter_levels
= reg.input :code, :label => "Confirmation or registration code (if applicable)"
@ -38,11 +38,6 @@
%br Yes, I'll be attending...
%br
= f.input :social_events, :as => :check_boxes, :label => false
- if @conference.use_dietary_choices?
= f.inputs "Food" do
= f.input :dietary_choice, :collection => [["None", nil]] + @conference.dietary_choices.map {|x| [x.title, x.id]},
:include_blank => false, :label => "Special Dietary Restriction"
= f.input :other_dietary_choice, :input_html => {:rows => "2"}, :label => "Other Dietary Restictions (please describe)"
:javascript
$("#registration_supporter_registration_attributes_supporter_level_id").change(function () {

View file

@ -12,7 +12,7 @@
= render :partial => "questions", :locals => {:f => f}
%br
- if @conference.use_supporter_levels? && @conference.supporter_levels.count > 0
- if @conference.use_supporter_levels? && @conference.supporter_levels.length > 0
= f.semantic_fields_for :supporter_registration do |reg|
= reg.input :supporter_level, :as => :select, :collection => @conference.supporter_levels
= reg.input :code, :label => "Confirmation or registration code (if applicable)"
@ -32,11 +32,6 @@
%br Yes, I'll be attending...
%br
= f.input :social_events, :as => :check_boxes, :label => false
- if @conference.use_dietary_choices?
= f.inputs "Food" do
= f.input :dietary_choice, :collection => [["None", nil]] + @conference.dietary_choices.map {|x| [x.title, x.id]},
:include_blank => false, :label => "Special Dietary Restriction"
= f.input :other_dietary_choice, :input_html => {:rows => "2"}, :label => "Other Dietary Restictions (please describe)"
.tabbable
%ul.nav.nav-tabs
%li.active

View file

@ -19,13 +19,16 @@
<br>
<span class="muted"><%= conference.date_range_string %></span>
</h3>
<% if conference.venue.name and conference.venue.website and conference.venue.address %>
<p>
<small>
<%= link_to conference.venue.name, conference.venue.website, :target => "_new" %>
,
<%= link_to conference.venue.address, "http://maps.google.com/maps?q=#{conference.venue.address}", :target => "_new" %>
<%= link_to conference.venue.name, conference.venue.website %>,
<%= link_to conference.venue.address, "http://maps.google.com/maps?q=#{conference.venue.address}" %>
</small>
<% end -%>
<% if conference.venue.description %>
<%= simple_format(conference.venue.description, class: 'lead') %>
<% end -%>
</div>
<div class="span2">
<ul class="nav nav-tabs nav-stacked">

View file

@ -9,70 +9,35 @@
- if user_signed_in?
- if has_role?(current_user, "admin") || has_role?(current_user, "organizer")
- if controller.class.name.split("::").first=="Admin"
- if @conference && !@conference.short_title.nil?
- if @conference and !@conference.short_title.nil?
%ul.nav
%li.nav-header.hidden-desktop
= @conference.short_title
- if current_page?(admin_conference_path(@conference.short_title))
%li.active
= link_to('#') do
%i.icon-wrench
Settings
- else
%li
= link_to(admin_conference_path(@conference.short_title)) do
%i.icon-wrench
Settings
- if current_page?(admin_conference_registrations_path(@conference.short_title))
%li.active
= link_to('#') do
%i.icon-user
Registrations
- else
%li
= link_to(admin_conference_registrations_path(@conference.short_title)) do
%i.icon-user
Registrations
- if current_page?(admin_conference_supporters_path(@conference.short_title))
%li.active
= link_to('#') do
%i.icon-star
Supporters
- else
%li
%li{:class=> active_nav_li(admin_conference_path(@conference.short_title))}
= link_to(admin_conference_path(@conference.short_title)) do
%i.icon-wrench
Settings
%li{:class=> active_nav_li(admin_conference_registrations_path(@conference.short_title))}
= link_to(admin_conference_registrations_path(@conference.short_title)) do
%i.icon-user
Registrations
- if @conference.use_supporter_levels? and @conference.supporter_levels.length > 0
%li{:class=> active_nav_li(admin_conference_supporters_path(@conference.short_title))}
= link_to(admin_conference_supporters_path(@conference.short_title)) do
%i.icon-star
Supporters
- if current_page?(admin_conference_events_path(@conference.short_title))
%li.active
= link_to('#') do
%i.icon-comment
Events
- else
%li
= link_to(admin_conference_events_path(@conference.short_title)) do
%i.icon-comment
Events
- if current_page?(admin_conference_stats_path(@conference.short_title))
%li.active
= link_to('#') do
%i.icon-tasks
Statistics
- else
%li
= link_to(admin_conference_stats_path(@conference.short_title)) do
%i.icon-tasks
Statistics
- if current_page?(admin_conference_volunteers_list_path(@conference.short_title))
%li.active
= link_to('#') do
%i.icon-user
Volunteers
- else
%li
= link_to(admin_conference_volunteers_list_path(@conference.short_title)) do
%i.icon-user
Volunteers
%li{:class=> active_nav_li(admin_conference_events_path(@conference.short_title))}
= link_to(admin_conference_events_path(@conference.short_title)) do
%i.icon-comment
Events
%li{:class=> active_nav_li(admin_conference_stats_path(@conference.short_title))}
= link_to(admin_conference_stats_path(@conference.short_title)) do
%i.icon-tasks
Statistics
%li{:class=> active_nav_li(admin_conference_volunteers_list_path(@conference.short_title))}
= link_to(admin_conference_volunteers_list_path(@conference.short_title)) do
%i.icon-user
Volunteers
%li
= link_to(admin_conference_schedule_path(@conference.short_title), :target => "_blank") do
%i.icon-calendar

View file

@ -4,7 +4,7 @@
%br
= f.fields_for :person do |p|
= p.text_field :public_name, :for => :person
- if @conference.use_supporter_levels?
- if @conference.use_supporter_levels? and @conference.supporter_levels.length > 0
= f.semantic_fields_for :supporter_registration do |reg|
= reg.input :supporter_level, :as => :select, :collection => @conference.supporter_levels
= reg.input :code, :label => "Confirmation or registration code (if applicable)"
@ -22,11 +22,6 @@
%br Yes, I'll be attending...
%br
= f.input :social_events, :as => :check_boxes, :label => false, :collection => @conference.social_events
- if @conference.use_dietary_choices?
= f.inputs "Food" do
= f.input :dietary_choice, :collection => [["None", nil]] + @conference.dietary_choices.map {|x| [x.title, x.id]},
:include_blank => false, :label => "Special Dietary Restriction"
= f.input :other_dietary_choice, :input_html => {:rows => "2", :class => "span6"}, :label => "Other Dietary Restictions (please describe)"
:javascript
$("#registration_supporter_registration_attributes_supporter_level_id").change(function () {
@ -56,4 +51,4 @@
onSelect: function(selected) {
$("#registration-arrival-datepicker").datepicker("option","maxDate", selected)
}
});
});