Revision 3158d6f6

b/cloudcms/static/cloudcms/css/styles.css
661 661
.resources .categories ul li a:hover, .resources .categories ul li a.selected {
662 662
  color: #000 !important;
663 663
}
664
.resources .categories ul li a.inactive {
665
  opacity: 0.4;
664
.resources .categories ul li.inactive {
665
  opacity: 0.3;
666
}
667
.resources .categories ul li.active {
668
  opacity: 1;
669
  font-weight: bold;
666 670
}
667 671
.resources .list {
668 672
  font-size: 0.9em;
......
734 738
  color: #808080;
735 739
}
736 740
.resources .list .resource .download {
741
  margin-left: -10px;
742
  margin-bottom: 3px;
737 743
  bottom: 0;
738 744
  position: absolute;
739 745
  font-size: 1.1em;
b/cloudcms/static/cloudcms/less/resources.less
19 19
                color: #000 !important;
20 20
            }
21 21

  
22
        }
23

  
24
        ul li {
22 25
            &.inactive {
23
                opacity: 0.4;
26
                opacity: 0.3;
27
            }
28
            &.active {
29
                opacity: 1;
30
                font-weight: bold;
24 31
            }
25 32
        }
26 33
    }
......
81 88
                a { color: @gray }
82 89
            }
83 90
            .download {
91
                margin-left: -10px;
92
                margin-bottom: 3px;
84 93
                a {
85 94
                    display: block;
86 95
                    color: @black;
b/cloudcmsresources/static/cloudcmsresources/js/resources_list.js
26 26

  
27 27
    var self = this;
28 28
    $(window).bind('hashchange', function() {
29
        //self.selected_category = window.location.hash.substring(1);
30
        //self.update_page_objects();
29
        self.selected_category = window.location.hash.substring(1);
30
        self.update_page_objects();
31
        self.update_selected_category();
31 32
    })
33

  
34
    self.update_page_objects();
35
    self.update_selected_category();
32 36
}
33 37

  
34 38
ResourcesModule.prototype.switch = function(hide, show) {
......
42 46
                }, 
43 47
                {
44 48
                    complete:function(){
45
                        console.log("complete");
46 49
                        hide.remove();
47 50
                        newshow.css({top:0});
48 51
                }
......
82 85
    $(el).show();
83 86
}
84 87

  
88
ResourcesModule.prototype.update_selected_category = function() {
89
    if (!this.selected_category) {
90
        this.categories.removeClass("inactive").removeClass("active");    
91
    }
92

  
93
    var to_hide = this.categories.filter("[data-id="+this.selected_category+"]");
94
    var to_show = this.categories.filter("[data-id!="+this.selected_category+"]");
95

  
96
    to_show.removeClass("active").addClass("inactive");
97
    to_hide.removeClass("inactive").addClass("active");
98
}
99

  
85 100
ResourcesModule.prototype.update_page_objects = function() {
86 101
    var to_show = this.resources().filter("[data-category="+this.selected_category+"]");
87 102
    var to_hide = this.resources().filter("[data-category!="+this.selected_category+"]");
88 103
        
89 104
    if (!this.selected_category) { to_show = this.resources(); }
90 105
    _.each(to_hide, function(el){
91
        $(el).fadeOut(100);
106
        $(el).hide();
107
    });
108

  
109
    _.each(to_show, function(el, i){
110
        if (i%3 == 0) {
111
            $(el).addClass("first");
112
        } else {
113
            $(el).removeClass("first");
114
        }
115
        $(el).fadeIn(40);
92 116
    });
93
    
94
    var delay = this.selected_category ? 40 : 0;
95
    var self = this;
96
    window.setTimeout(function(){
97
        _.each(to_show, function(el, i) {
98
            var new_main_height = (self.grid_height + self.grid_gap) * (Math.floor(to_show.length/3) + 1);
99
            if (self.el.height() < new_main_height) {
100
                self.el.height(new_main_height);
101
            }
102
        })
103
        self.animate_els(to_show);
104
    }, delay)
105 117
}
106 118

  
107 119
$(document).ready(function(){
b/cloudcmsresources/templates/content/resources_list.html
38 38
                <p>{{ r.translation.description }}</p>
39 39
            </div>
40 40
            <div class="download">
41
                <a class="resource-download" href="{{ r.media_file.get_absolute_link }}">
41
                <a class="resource-download" target="_blank" href="{{ r.media_file.get_absolute_url }}">
42 42
                    <span class="download-image"></span>
43 43
                    <span>{% trans "DOWNLOAD" %} {{ r.get_filetype }}</span>
44 44
                </a>

Also available in: Unified diff