[ckan-dev] ckan-dev Digest, Vol 90, Issue 13

Alessandro.DALLA-BENETTA at ext.ec.europa.eu Alessandro.DALLA-BENETTA at ext.ec.europa.eu
Fri Apr 27 08:33:19 UTC 2018


Hi Knud,

many thanks for the response, clear for me.

Now, I would like to updated the sprite-icons file to add the MS access icon. I found this project https://github.com/mintcanary/file-types where there are the original icons but in PSD format, not very usefull for me. Are there any projects/extensions where the source format is in SVG in order to create/update the resource icons of CKAN ?

Cheers,
Alessandro.
________________________________________
From: ckan-dev [ckan-dev-bounces at lists.okfn.org] on behalf of ckan-dev-request at lists.okfn.org [ckan-dev-request at lists.okfn.org]
Sent: 25 April 2018 14:00
To: ckan-dev at lists.okfn.org
Subject: ckan-dev Digest, Vol 90, Issue 13

Send ckan-dev mailing list submissions to
        ckan-dev at lists.okfn.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.okfn.org/mailman/listinfo/ckan-dev
or, via email, send a message with subject or body 'help' to
        ckan-dev-request at lists.okfn.org

You can reach the person managing the list at
        ckan-dev-owner at lists.okfn.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of ckan-dev digest..."


Today's Topics:

   1. Re: MS Access icon for the resources (Knud M?ller)


----------------------------------------------------------------------

Message: 1
Date: Tue, 24 Apr 2018 08:56:56 -0400
From: Knud M?ller <knud at datalysator.com>
To: alessandro.dalla-benetta at ext.ec.europa.eu,  CKAN Development
        Discussions <ckan-dev at lists.okfn.org>
Subject: Re: [ckan-dev] MS Access icon for the resources
Message-ID:
        <CA+ZT7PpzeG_NNaHFv7FhwRBvc4sPBBP2ZkfZ6N2cbw091re2Bg at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi Alessandro,

I?m not sure if there maybe is an easier way, but here is how I thinks it
basically works. Note that you?ll have to write your own CKAN plugin [1] to
do it.

- When you add a new resource in CKAN, the string entered in the ?Format?
field will later be used in the ?data-format? attribute when this resource
is rendered e.g. in the /templates/package/snippets/resource_item.html
template:

<span class="format-label" property="dc:format" data-format="{{
res.format.lower() or 'data' }}?> ? </span>

- This template renders e.g. like this for a particular resource from our
site:

<span class="format-label" property="dc:format"
data-format="gtfs">GTFS</span>

- Now you ?only? need a CSS rule that replaces the ?GTFS? string with the
icon you want:

.format-label[data-format=gtfs] {
  background: url("/url/to/your/icon") no-repeat 0 0;
}

- The way this is handled for the standard icons included in CKAN core,
there is one image which contains all icons in /public/base/i
ages/sprite-resource-icons.png, and the rules for the different resource
formats just moves the background position. E.g.:

/* generic rule for all icons */
.format-label {
  background: url("../../../base/images/sprite-resource-icons.png")
no-repeat 0 0;
}

/* specific rule for a particular resource format */
.format-label[data-format=rdf] {
  background-position: -32px -62px;
}
.format-label[data-format=pdf] {
  background-position: -64px -62px;
}
.format-label[data-format=xls] {
  background-position: -160px -62px;
}

(I have shortened the rules, look in /public/base/css for the full versions)

Hope this helps!

Cheers,
Knud


[1] http://docs.ckan.org/en/ckan-2.7.3/extensions/index.html

On 23 April 2018 at 11:36:29, alessandro.dalla-benetta at ext.ec.europa.eu (
alessandro.dalla-benetta at ext.ec.europa.eu) wrote:

Hi all,
in the default ckan icon set for the resources is missing the file format
MS Access.
How it's possible to extend the icon set with this format in CKAN ?

Cheers,

Alessandro Dalla Benetta.
_______________________________________________
ckan-dev mailing list
ckan-dev at lists.okfn.org
https://lists.okfn.org/mailman/listinfo/ckan-dev
Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20180424/15b71ec2/attachment-0001.html>

------------------------------

Subject: Digest Footer

_______________________________________________
ckan-dev mailing list
ckan-dev at lists.okfn.org
https://lists.okfn.org/mailman/listinfo/ckan-dev
Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev


------------------------------

End of ckan-dev Digest, Vol 90, Issue 13
****************************************



More information about the ckan-dev mailing list