Added User.find() & fixed scroll history bug

This commit is contained in:
Rishabh Nambiar 2018-08-14 16:36:28 +05:30
parent 6e806cc1df
commit 83b1fcb54b
3 changed files with 7 additions and 3 deletions

View File

@ -90,6 +90,10 @@ export default Ember.Controller.extend({
window.open(this.get('selectedItem.downloadUrl'), "_blank");
},
scrollTop() {
window.scrollTo(0,0);
},
resetParams() {
this.get('selectedItem').resetParams();
},

View File

@ -145,7 +145,7 @@
{{#each sortedQueries as |query|}}
<tr>
<td>
<a href="/admin/plugins/explorer/?id={{query.id}}">
<a {{action "scrollTop"}} href="/admin/plugins/explorer/?id={{query.id}}">
<b class="query-name">{{query.name}}</b>
<br>
<medium class="query-desc">{{query.description}}</medium>

View File

@ -941,9 +941,9 @@ SQL
# guardian.ensure_can_create_explorer_query!
query = DataExplorer::Query.from_hash params.require(:query)
query.created_by = current_user.id.to_s
query.created_at = Time.now.strftime("%b %e, %Y")
query.username = current_user.username
query.created_by = current_user.id.to_s
query.username = User.find(query.created_by).username
query.id = nil # json import will assign an id, which is wrong
query.save