okfnepal / election-nepal

A crowdsourced open portal that brings all kind of Data related to Nepal's Local Election.
http://electionnepal.org
MIT License
19 stars 11 forks source link

As a user, i would like to see data on the website rather on git #33

Closed rackeranjani closed 7 years ago

rackeranjani commented 7 years ago

As a user, i would like to see data on the website rather on git

nirmalrizal commented 7 years ago

Yeah we can use two option for dataset

  1. View
  2. Download On view we can display the data in table like as in the excel and on download we can simply let the user download that data.
amitness commented 7 years ago

This might be a solution: http://datapipes.okfnlabs.org/html/ . It's a tool by Open Knowledge International themselves.

For example, to show this data https://raw.githubusercontent.com/okfnepal/election-nepal-data/master/Political%20Parties%20Contact%20Info.csv, we'll add this url to http://datapipes.okfnlabs.org/csv/html/?url= and get the HTML table as output.

Demo: http://datapipes.okfnlabs.org/csv/html/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fokfnepal%2Felection-nepal-data%2Fmaster%2FPolitical%2520Parties%2520Contact%2520Info.csv

nikeshbalami commented 7 years ago

I think @sagargg just solved this issue, Is this done by using the solution proposed by @studenton or was done by using new way.

amitness commented 7 years ago

@nikeshbalami Not sure, but looking at the commits, I think he adopted some different approach. It's even better.

nikeshbalami commented 7 years ago

Yeah I also like it, Kudos @sagargg :1st_place_medal:

nirmalrizal commented 7 years ago

@sagargg The third column data on every table contains hyperlink. I tried but didn't found from where it was coming. May be you could fix that.

nikeshbalami commented 7 years ago

Ohh Yeah, I didn't noticed it previously :P

amitness commented 7 years ago

@sagargg The tracked down the problem to custom_formatting. I think there is some reason you put it up there, so I haven't tried to fix it.

 <script type="text/javascript">
        function format_link(link) {
            if (link)
                return "<a href='" + link + "' target='_blank'>" + link + "</a>";
            else
                return "";
        }
        CsvToHtmlTable.init({
            csv_path: '{{ dataset_id.GitHub_Link }}',
            element: 'table-container',
            allow_download: true,
            csv_options: {separator: ',', delimiter: '"'},
            datatables_options: {"paging": true},
            custom_formatting: [[2, format_link]]
        });
        $(document).ready(function () {
            $('#table-container-table_wrapper').DataTable();

        });