Skip to content

Commit

Permalink
Fix tag suggestions to show all relevant ones (#7338)
Browse files Browse the repository at this point in the history
* Fixes #7263 At location button to dashboard sidebar

* Fixes #7263 At location button to dashboard sidebar

* Trying new code to fix issue

* feature suggests tags in subscriptions

* removed trailing white space

* changed .each to .select

* changed .each to .select

* resolved error

* resolved error

* Test run

* Test run

* Test run 2
  • Loading branch information
imajit authored Apr 6, 2020
1 parent dfeabe3 commit cc00525
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/models/tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@ def self.graph_data(limit = 250)
end
end

def self.all_tags_by_popularity
Tag.all.order('count DESC').select { |tag| !(tag.name.include? ":") }.uniq(&:name).pluck(:name)
end

def subscription_graph(start = DateTime.now - 1.year, fin = DateTime.now)
date_hash = {}
week = start.to_date.step(fin.to_date, 7).count
Expand Down
2 changes: 1 addition & 1 deletion app/views/home/subscriptions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<div class="form-group">
<div class="row">
<div class="col-md-7">
<input type="text" name="name" class="form-control" placeholder="<%= translation('home.subscriptions.enter_tags') %>" data-provide="typeahead" data-source='["balloon-mapping","thermal-flashlight","spectrometer"]' autocomplete="off" required="required">
<input type="text" name="name" class="form-control" placeholder="<%= translation('home.subscriptions.enter_tags') %>" data-provide="typeahead" data-source='<%= Tag.all_tags_by_popularity %>' autocomplete="off" required="required">
</div>
<div class="col-md-2 pl-md-1">
<button type="submit" class="btn btn-primary add-subscriptions"><i class="fa fa-plus fa fa-white"></i> <%= translation('home.subscriptions.add') %></button>
Expand Down

0 comments on commit cc00525

Please sign in to comment.