Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</template>
<div v-if="publicQueries.length">
<div
v-for="{ id, attributes: { sql, name }} in publicQueries"
v-for="{ id, attributes: { sql, name, author }} in publicQueries"
:key="id"
class="gobierto-data-summary-queries-container"
@mouseover="showSQLCode(sql)"
Expand All @@ -71,6 +71,14 @@
>
{{ name }}
</router-link>

<span style="display:block; padding-left:1em; font-size:0.875rem">
<i
class="fas fa-user icons-your-queries"
style="color:var(--color-base);"
/>
{{ author }}
</span>
</div>
</div>
<template v-else>
Expand Down
8 changes: 6 additions & 2 deletions app/serializers/gobierto_data/query_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ module GobiertoData
class QuerySerializer < ActiveModel::Serializer
include Rails.application.routes.url_helpers

attributes :id
attributes :id, :privacy_status, :sql, :dataset_id, :user_id, :author
attribute :name, unless: :with_translations?
attribute :name_translations, if: :with_translations?
attributes :privacy_status, :sql, :dataset_id, :user_id

belongs_to :dataset, unless: :exclude_relationships?
belongs_to :user, unless: :exclude_relationships?
has_many :visualizations, unless: :exclude_relationships?
Expand All @@ -20,6 +20,10 @@ class QuerySerializer < ActiveModel::Serializer
}
end

def author
object.user.name
end

def current_site
Site.find(object.site.id)
end
Expand Down