Commit c788cbd487b4d61e9f55304560057ee1d41144ab

  • avatar
  • arvind
  • Wed Sep 03 17:50:19 IST 2014
Updates to linked data page.
        - Images related to tag or user are shown below the tags/user
        count.
        - Scroll to the image after the image is loaded.
  
149149}
150150#tag-cloud {
151151 display: none;
152 height:768px;
152}
153#gallery {
154 margin-top: 10em;
153155}
154156#tags-tag-cloud svg {
155157 position: absolute;
  
718718 },
719719 userTagClicked: function(e) {
720720 var user = $(e.currentTarget).text();
721 console.log(user);
722721 var swts = swtr.LDs.filter(function(swt) {
723722 if(swt.get('who') == user) {
724723 return swt;
725725 });
726726 swts = _.uniq(swts,'how'.src);
727727 this.setGalleryView(swts);
728 $(this.el).hide();
728 // $(this.el).hide();
729729 },
730730 tagsTagClicked: function(e) {
731731 var tag = $(e.currentTarget).text();
737737 }
738738 });
739739 this.setGalleryView(swts);
740 $(this.el).hide();
740 // $(this.el).hide();
741741 },
742742 setGalleryView: function(swts) {
743743 if(this.galleryView) {
760760 _.each(weights, function(weight, who) {
761761 $(this.user_tag_el).append(this.template({weight: weight, who: who}));
762762 }, this);
763 // d3.layout.cloud().size([1000, 1000])
764 // .words(words.map(function(d) {
765 // return {text: d, size: 5};
766 // }))
767 // .padding(5)
768 // .font("Impact")
769 // .fontSize(function(d) { return d.size; })
770 // .on("end", this.draw)
771 // .start();
772763 },
773 draw: function (words) {
774 var fill = d3.scale.category20();
775 d3.select("#user-tag-cloud").append("svg")
776 .append("g")
777 .attr("transform", "translate(370,180)")
778 .selectAll("text")
779 .data(words)
780 .enter().append("text")
781 .style("font-size", function(d) { return "16px"; })
782 .style("font-family", "Impact")
783 .style("fill", function(d, i) { return fill(i); })
784 .attr("text-anchor", "middle")
785 .attr("transform", function(d) {
786 return "translate(" + [d.x, d.y] + ")";})
787 .text(function(d) { return d.text; });
788 },
789764 renderTagsTagCloud: function() {
790765 var sweetsWithTags = swtr.LDs.filter(function(k) {
791766 if(k.get('how').tags) {
776776 $(this.tags_tag_el).append(this.template({weight: weight, who: who}));
777777 }, this);
778778
779 },
780 drawTags: function(words) {
781 var fill = d3.scale.category20();
782 d3.select("#tags-tag-cloud").append("svg")
783 .append("g")
784 .attr("transform", "translate(700,300)")
785 .selectAll("text")
786 .data(words)
787 .enter().append("text")
788 .style("font-size", function(d) { return "20px"; })
789 .style("font-family", "Impact")
790 .style("fill", function(d, i) { return fill(i); })
791 .attr("text-anchor", "middle")
792 .attr("transform", function(d) {
793 return "translate(" + [d.x, d.y] + ")";
794 })
795 .text(function(d) { return d.text; });
796779 }
797780 });
798781
790790 _.each(this.collection, function(model) {
791791 $(this.el).append(this.template(model.toJSON()));
792792 }, this);
793 $('html, body').animate({
794 scrollTop: $("#gallery").offset().top
795 }, 1000);
793796 },
794797 setUp: function() {
795798 if(!$(this.el).is(':visible')) {
  
162162 <div id="search-page" class="page"></div>
163163
164164 <div id="linked-data-page" class="page">
165 <div id="tag-cloud" class="col-md-4">
165 <div id="tag-cloud" class="row">
166166 <div class="panel-group" id="accordion">
167 <div class="panel panel-default">
168 <div class="panel-heading">
169 <h4 class="panel-title">
167 <div class="col-md-6">
168 <div class="panel panel-default">
169 <div class="panel-heading">
170170 <a data-toggle="collapse" data-parent="#accordion" href="#tag-list">
171 Tags
171 <h4 class="panel-title">
172 Tags
173 </h4>
172174 </a>
173 </h4>
174 </div>
175 <div id="tag-list" class="panel-collapse collapse in">
176 <div class="panel-body">
177 <ul class="list-group" id="tags-tag-cloud"></ul>
178175 </div>
176 <div id="tag-list" class="panel-collapse collapse in">
177 <div class="panel-body">
178 <ul class="list-group" id="tags-tag-cloud"></ul>
179 </div>
180 </div>
179181 </div>
180182 </div>
181 <div class="panel panel-default">
182 <div class="panel-heading">
183 <h4 class="panel-title">
183 <div class="col-md-6">
184 <div class="panel panel-default">
185 <div class="panel-heading">
184186 <a data-toggle="collapse" data-parent="#accordion" href="#user-list">
185 User
187 <h4 class="panel-title">
188 User
189 </h4>
186190 </a>
187 </h4>
188 </div>
189 <div id="user-list" class="panel-collapse collapse in">
190 <div class="panel-body">
191 <ul class="list-group" id="user-tag-cloud"></ul>
192191 </div>
192 <div id="user-list" class="panel-collapse collapse in">
193 <div class="panel-body">
194 <ul class="list-group" id="user-tag-cloud"></ul>
195 </div>
196 </div>
193197 </div>
194198 </div>
195199 </div>
196200 </div>
197 <div id="gallery">
201 <div id="gallery" class="row">
198202 </div>
199203 </div>
200204