Refactor selected aspects ui setup
This commit is contained in:
parent
7994c4d43f
commit
583dd20249
3 changed files with 2 additions and 15 deletions
|
|
@ -9,7 +9,7 @@
|
|||
%ul.sub_nav
|
||||
%a.toggle_selector{:href => '#'}
|
||||
- for aspect in all_aspects
|
||||
%li{:data => {:aspect_id => aspect.id}, :class => ("active" if params["a_id"].to_i == aspect.id)}
|
||||
%li{:data => {:aspect_id => aspect.id}, :class => ("active" if defined?(selected_aspects) && selected_aspects.include?(aspect.id))}
|
||||
.edit
|
||||
= link_to image_tag("icons/pencil.svg", :height => 12, :title => t('.edit_aspect', :name => aspect.name)), edit_aspect_path(aspect), :rel => "facebox"
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
= link_to "Welcome", getting_started_path, :class => "home_selector"
|
||||
|
||||
.section
|
||||
= render 'aspects/aspect_listings'
|
||||
= render 'aspects/aspect_listings', :selected_aspects => @stream.aspect_ids
|
||||
|
||||
.section
|
||||
%ul.left_nav
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
toggleSelector: aspectNavigation.find("a.toggle_selector")
|
||||
});
|
||||
|
||||
self.initializeSelectedAspects();
|
||||
self.calculateToggleText();
|
||||
self.aspectSelectors.click(self.toggleAspect);
|
||||
self.toggleSelector.click(self.toggleAll);
|
||||
|
|
@ -25,18 +24,6 @@
|
|||
return self.aspectNavigation.find("li.active[data-aspect_id]").map(function() { return $(this).data('aspect_id') });
|
||||
};
|
||||
|
||||
this.initializeSelectedAspects = function() {
|
||||
if (location.href.search("a_ids..=") == -1) {
|
||||
self.aspectLis.addClass("active");
|
||||
} else {
|
||||
self.aspectSelectors.each(function() {
|
||||
guid = $(this).data('guid');
|
||||
if (guid && location.href.search("a_ids..=" + guid + "(#|&|$)") != -1)
|
||||
$(this).parent().addClass('active');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.toggleAspect = function(evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue