Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: 2855 show user identifier next to query name #3877

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
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