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"); window.open(this.get('selectedItem.downloadUrl'), "_blank");
}, },
scrollTop() {
window.scrollTo(0,0);
},
resetParams() { resetParams() {
this.get('selectedItem').resetParams(); this.get('selectedItem').resetParams();
}, },

View File

@ -145,7 +145,7 @@
{{#each sortedQueries as |query|}} {{#each sortedQueries as |query|}}
<tr> <tr>
<td> <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> <b class="query-name">{{query.name}}</b>
<br> <br>
<medium class="query-desc">{{query.description}}</medium> <medium class="query-desc">{{query.description}}</medium>

View File

@ -941,9 +941,9 @@ SQL
# guardian.ensure_can_create_explorer_query! # guardian.ensure_can_create_explorer_query!
query = DataExplorer::Query.from_hash params.require(: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.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.id = nil # json import will assign an id, which is wrong
query.save query.save