From d0d1dc568c81ef5b95a486f4e28f6e49082e90dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 13 Mar 2017 21:09:02 +0100 Subject: [PATCH 01/47] add separate readme for server --- README.md | 62 -------------------------------------------- monumental/README.md | 27 +++++++++++++++++++ 2 files changed, 27 insertions(+), 62 deletions(-) create mode 100644 monumental/README.md diff --git a/README.md b/README.md index 169cbc2..c8c447d 100644 --- a/README.md +++ b/README.md @@ -1,65 +1,3 @@ # Monumental Reasonator for monuments - -## Server - -A small python server providing authorization for edit actions on Wikidata. - -### Local setup - -1. Install python requirements - -```bash -pip install -r requirements.txt -``` - -2. Setup config.yaml - -Copy config.default.yaml to config.local.yaml. You may need to add oauth consumer info, which you can apply for [here](https://meta.wikimedia.org/wiki/Special:OAuthConsumerRegistration/propose). If you need a set of keys for testing purposes (running on localhost:5000), you can email me at . - -3. Run the dev server - -```bash -python monumental/server.py -``` - -Test it out: - - - Login: http://localhost:5000/login - - A simple Wikidata API query: http://localhost:5000/api?action=query&list=random&rnnamespace=0&rnlimit=10 - - Get an edit token (with authorization): http://localhost:5000/api?action=query&meta=tokens&use_auth=true - -See [here](https://www.wikidata.org/w/api.php) for full Wikidata API docs. - -### Licnese - -Copyright (c) 2017, Stephen LaPorte - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * The names of the contributors may not be used to endorse or - promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/monumental/README.md b/monumental/README.md new file mode 100644 index 0000000..7cddd82 --- /dev/null +++ b/monumental/README.md @@ -0,0 +1,27 @@ +A small python server providing authorization for edit actions on Wikidata. + +### Local setup + +1. Install python requirements + +```bash +pip install -r requirements.txt +``` + +2. Setup config.yaml + +Copy config.default.yaml to config.local.yaml. You may need to add oauth consumer info, which you can apply for [here](https://meta.wikimedia.org/wiki/Special:OAuthConsumerRegistration/propose). If you need a set of keys for testing purposes (running on localhost:5000), you can email me at . + +3. Run the dev server + +```bash +python monumental/server.py +``` + +Test it out: + + - Login: http://localhost:5000/login + - A simple Wikidata API query: http://localhost:5000/api?action=query&list=random&rnnamespace=0&rnlimit=10 + - Get an edit token (with authorization): http://localhost:5000/api?action=query&meta=tokens&use_auth=true + +See [here](https://www.wikidata.org/w/api.php) for full Wikidata API docs. From d1c1a64f14bf44055b140ac1776ba660a2743560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Wed, 15 Mar 2017 21:25:49 +0100 Subject: [PATCH 02/47] feat(monument): add basic api edit --- src/components/main/dashboard/dashboard.html | 2 + src/components/main/dashboard/dashboard.js | 17 ++++++++- src/components/main/monument/monument.js | 12 ++++++ src/index.js | 2 +- src/services/wiki.service.js | 39 ++++++++++++++++---- 5 files changed, 63 insertions(+), 9 deletions(-) diff --git a/src/components/main/dashboard/dashboard.html b/src/components/main/dashboard/dashboard.html index 5334e7e..91ba722 100644 --- a/src/components/main/dashboard/dashboard.html +++ b/src/components/main/dashboard/dashboard.html @@ -1,4 +1,6 @@ +
+ Login
diff --git a/src/components/main/dashboard/dashboard.js b/src/components/main/dashboard/dashboard.js index ee1c857..c947367 100644 --- a/src/components/main/dashboard/dashboard.js +++ b/src/components/main/dashboard/dashboard.js @@ -3,11 +3,26 @@ import template from './dashboard.html'; const DashboardComponent = { controller, template }; -function controller($state, localStorageService) { +function controller($state, $window, WikiService, localStorageService) { const vm = this; vm.languages = localStorageService.get('languages') || ['en', 'de']; + vm.loading = false; + vm.login = login; vm.saveLanguages = saveLanguages; + init(); + + function init() { + WikiService.getToken().then((data) => { + console.log(data); + }); + } + + function login() { + vm.loading = true; + $window.location.pathname = '/login'; + } + function saveLanguages() { vm.languages.indexOf('en') === -1 ? vm.languages.push('en') : false; localStorageService.set('languages', vm.languages.filter(lang => lang)); diff --git a/src/components/main/monument/monument.js b/src/components/main/monument/monument.js index 2778632..0a3975b 100644 --- a/src/components/main/monument/monument.js +++ b/src/components/main/monument/monument.js @@ -14,6 +14,18 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora vm.image = []; vm.map = {}; + vm.addCategory = function() { + WikiService.setClaim({ + action: 'wbcreateclaim', + format: 'json', + entity: `${id}`, + property: 'P373', + snaktype: 'value', + summary: '#monumental', + value: '"Mikołów town hall"', + }); + }; + let langs = $stateParams.lang ? [$stateParams.lang] : []; langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); diff --git a/src/index.js b/src/index.js index 88e164c..d882af5 100644 --- a/src/index.js +++ b/src/index.js @@ -35,7 +35,7 @@ angular 'restangular', 'infinite-scroll', 'leaflet-directive', - 'LocalStorageModule' + 'LocalStorageModule', ]) .config(localStorageConfig) .config(stateConfig) diff --git a/src/services/wiki.service.js b/src/services/wiki.service.js index e6ef441..5ba8c36 100644 --- a/src/services/wiki.service.js +++ b/src/services/wiki.service.js @@ -1,17 +1,18 @@ import _ from 'lodash'; -const WikiService = function ($http, $q) { - +const WikiService = function ($http, $httpParamSerializerJQLike) { const service = { - getArticleHeader: getArticleHeader, - getCategoryMembers: getCategoryMembers, - getImage: getImage + getArticleHeader, + getCategoryMembers, + getImage, + getToken, + setClaim, }; const defaultParams = { action: 'query', format: 'json', - callback: 'JSON_CALLBACK' + callback: 'JSON_CALLBACK', }; const categoryFilesParams = angular.extend({}, defaultParams, { @@ -67,10 +68,34 @@ const WikiService = function ($http, $q) { return angular.extend({}, image, { imageinfo: image.imageinfo[0] }); }); } + + function getToken() { + return $http.get('/api', { + params: { + action: 'query', + meta: 'tokens', + use_auth: 'true', + }, + }).then((response) => { + if (response.data && response.data.query) { + return response.data.query.tokens.csrftoken; + } + return false; + }); + } + + function setClaim(params) { + return $http({ + method: 'POST', + url: '/api', + data: $httpParamSerializerJQLike(angular.extend({ use_auth: true }, params)), + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + }); + } }; export default () => { angular .module('monumental') .factory('WikiService', WikiService); -}; \ No newline at end of file +}; From ee5b451d4f332ce06794c09bf6b93fe23449ee4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Thu, 16 Mar 2017 17:29:40 +0100 Subject: [PATCH 03/47] feat(app): code lint, visual redesign --- src/components/index.js | 0 src/components/main/dashboard/dashboard.html | 1302 +++++++++--------- src/components/main/dashboard/dashboard.js | 0 src/components/main/dashboard/dashboard.scss | 16 +- src/components/main/list/list.html | 136 +- src/components/main/list/list.js | 280 ++-- src/components/main/list/list.scss | 114 +- src/components/main/main.html | 0 src/components/main/main.js | 56 +- src/components/main/main.scss | 34 +- src/components/main/map/map.html | 120 +- src/components/main/map/map.js | 282 ++-- src/components/main/map/map.scss | 172 +-- src/components/main/monument/monument.html | 340 +++-- src/components/main/monument/monument.js | 3 +- src/components/main/monument/monument.scss | 266 ++-- src/images/marker.png | Bin src/index.js | 4 +- src/index_dev.ejs | 32 +- src/index_local.ejs | 32 +- src/services/index.js | 22 +- src/services/map.service.js | 134 +- src/services/theme.service.js | 52 +- src/services/wiki.service.js | 0 src/services/wikidata.service.js | 378 ++--- src/styles/_general.scss | 164 +-- src/styles/_responsive.scss | 38 +- src/styles/_variables.scss | 4 +- src/styles/style.scss | 8 +- 29 files changed, 2036 insertions(+), 1953 deletions(-) mode change 100644 => 100755 src/components/index.js mode change 100644 => 100755 src/components/main/dashboard/dashboard.html mode change 100644 => 100755 src/components/main/dashboard/dashboard.js mode change 100644 => 100755 src/components/main/dashboard/dashboard.scss mode change 100644 => 100755 src/components/main/list/list.html mode change 100644 => 100755 src/components/main/list/list.js mode change 100644 => 100755 src/components/main/list/list.scss mode change 100644 => 100755 src/components/main/main.html mode change 100644 => 100755 src/components/main/main.js mode change 100644 => 100755 src/components/main/main.scss mode change 100644 => 100755 src/components/main/map/map.html mode change 100644 => 100755 src/components/main/map/map.js mode change 100644 => 100755 src/components/main/map/map.scss mode change 100644 => 100755 src/components/main/monument/monument.html mode change 100644 => 100755 src/components/main/monument/monument.js mode change 100644 => 100755 src/components/main/monument/monument.scss mode change 100644 => 100755 src/images/marker.png mode change 100644 => 100755 src/index.js mode change 100644 => 100755 src/index_dev.ejs mode change 100644 => 100755 src/index_local.ejs mode change 100644 => 100755 src/services/index.js mode change 100644 => 100755 src/services/map.service.js mode change 100644 => 100755 src/services/theme.service.js mode change 100644 => 100755 src/services/wiki.service.js mode change 100644 => 100755 src/services/wikidata.service.js mode change 100644 => 100755 src/styles/_general.scss mode change 100644 => 100755 src/styles/_responsive.scss mode change 100644 => 100755 src/styles/_variables.scss mode change 100644 => 100755 src/styles/style.scss diff --git a/src/components/index.js b/src/components/index.js old mode 100644 new mode 100755 diff --git a/src/components/main/dashboard/dashboard.html b/src/components/main/dashboard/dashboard.html old mode 100644 new mode 100755 index 91ba722..805a369 --- a/src/components/main/dashboard/dashboard.html +++ b/src/components/main/dashboard/dashboard.html @@ -1,652 +1,652 @@ - -
- Login -
-
- -
-
-

Europe

- Adana (Turkey) • - Almaty (Kazakhstan) • - Amsterdam (Netherlands) • - Ankara (Turkey) • - Antalya (Turkey) • - Astana (Kazakhstan) • - Astrakhan (Russia) • - Athens (Greece) • - Baku (Azerbaijan) • - Balıkesir (Turkey) • - Barcelona (Spain) • - Barnaul (Russia) • - Belgrade (Serbia) • - Berlin (Germany) • - Birmingham (United Kingdom) • - Bratislava (Slovakia) • - Bremen (Germany) • - Brussels (Belgium) • - Bucharest (Romania) • - Budapest (Hungary) • - Bursa (Turkey) • - Chelyabinsk (Russia) • - Chișinău (Moldova) • - Cologne (Germany) • - Copenhagen (Denmark) • - Denizli (Turkey) • - Dnipro (Ukraine) • - Donetsk (Ukraine) • - Dortmund (Germany) • - Dresden (Germany) • - Dublin (Ireland) • - Düsseldorf (Germany) • - Essen (Germany) • - Frankfurt (Germany) • - Free Hanseatic City of Bremen (Germany) • - Ganja (Azerbaijan) • - Gaziantep (Turkey) • - Genoa (Italy) • - Glasgow (United Kingdom) • - Gomel (Belarus) • - Gothenburg (Sweden) • - Hamburg (Germany) • - Hanover (Germany) • - Helsinki (Finland) • - Istanbul (Turkey) • - Kayseri (Turkey) • - Kazan (Russia) • - Kemerovo (Russia) • - Khabarovsk (Russia) • - Kharkiv (Ukraine) • - Kraków (Poland) • - Krasnoyarsk (Russia) • - Kryvyi Rih (Ukraine) • - Kyiv (Ukraine) • - Leeds (United Kingdom) • - Leipzig (Germany) • - Lisbon (Portugal) • - London (United Kingdom) • - Lviv (Ukraine) • - Madrid (Spain) • - Makhachkala (Russia) • - Marseille (France) • - Milan (Italy) • - Minsk (Belarus) • - Moscow (Russia) • - Munich (Germany) • - Málaga (Spain) • - Naberezhnye Chelny (Russia) • - Naples (Italy) • - Nizhny Novgorod (Russia) • - Novosibirsk (Russia) • - Nuremberg (Germany) • - Omsk (Russia) • - Oslo (Norway) • - Palermo (Italy) • - Paris (France) • - Penza (Russia) • - Perm (Russia) • - Poznań (Poland) • - Prague (Czech Republic) • - Riga (Latvia) • - Rome (Italy) • - Rostov-on-Don (Russia) • - Rotterdam (Netherlands) • - Saint Petersburg (Russia) • - Samara (Russia) • - Seville (Spain) • - Sheffield (United Kingdom) • - Shymkent (Kazakhstan) • - Skopje (Republic of Macedonia) • - Sofia (Bulgaria) • - Stockholm (Sweden) • - Stuttgart (Germany) • - Tbilisi (Georgia) • - The Hague (Netherlands) • - Tolyatti (Russia) • - Turin (Italy) • - Tyumen (Russia) • - Ufa (Russia) • - Ulyanovsk (Russia) • - Valencia (Spain) • - Vienna (Austria) • - Vilnius (Lithuania) • - Vladivostok (Russia) • - Volgograd (Russia) • - Voronezh (Russia) • - Warsaw (Poland) • - Wrocław (Poland) • - Yaroslavl (Russia) • - Yekaterinburg (Russia) • - Yerevan (Armenia) • - Zagreb (Croatia) • - Zaporizhzhya (Ukraine) • - Zaragoza (Spain) • - İzmir (Turkey) • - Łódź (Poland) -
-
-

Africa

- Abeokuta (Nigeria) • - Abidjan (Côte d'Ivoire) • - Abuja (Nigeria) • - Accra (Ghana) • - Addis Ababa (Ethiopia) • - Agadir (Morocco) • - Alexandria (Egypt) • - Algiers (Algeria) • - Antananarivo (Madagascar) • - Asmara (Eritrea) • - Bangui (Central African Republic) • - Benghazi (Libya) • - Blantyre (Malawi) • - Bouaké (Côte d'Ivoire) • - Brazzaville (Republic of the Congo) • - Bujumbura (Burundi) • - Bulawayo (Zimbabwe) • - Cairo (Egypt) • - Conakry (Guinea) • - Dar es Salaam (Tanzania) • - Djibouti (Djibouti) • - Douala (Cameroon) • - Fes (Morocco) • - Freetown (Sierra Leone) • - Giza (Egypt) • - Harare (Zimbabwe) • - Helwan (Egypt) • - Ife (Nigeria) • - Ilorin (Nigeria) • - Johannesburg (South Africa) • - Jos (Nigeria) • - Kaduna (Nigeria) • - Kampala (Uganda) • - Khartoum (Sudan) • - Khartoum North (Sudan) • - Kigali (Rwanda) • - Kinshasa (Democratic Republic of the Congo) • - Kitwe (Zambia) • - Kumasi (Ghana) • - Lagos (Nigeria) • - Libreville (Gabon) • - Lilongwe (Malawi) • - Lomé (Togo) • - Luanda (Angola) • - Lubumbashi (Democratic Republic of the Congo) • - Lusaka (Zambia) • - Maiduguri (Nigeria) • - Maputo (Mozambique) • - Marrakesh (Morocco) • - Matola (Mozambique) • - Mombasa (Kenya) • - Monrovia (Liberia) • - N'Djamena (Chad) • - Nairobi (Kenya) • - Niamey (Niger) • - Nouakchott (Mauritania) • - Ogbomosho (Nigeria) • - Omdurman (Sudan) • - Ouagadougou (Burkina Faso) • - Port Said (Egypt) • - Pretoria (South Africa) • - Rabat (Morocco) • - Sekondi-Takoradi (Ghana) • - Shubra El-Kheima (Egypt) • - Tripoli (Libya) • - Yaoundé (Cameroon) -
-
-

Asia

- Abu Dhabi (United Arab Emirates) • - Adana (Turkey) • - Aden (Yemen) • - Agartala (India) • - Agra (India) • - Ahvaz (Iran) • - Al Ain (United Arab Emirates) • - Al Hudaydah (Yemen) • - Aleppo (Syria) • - Alexandria (Egypt) • - Almaty (Kazakhstan) • - Amman (Jordan) • - An Najaf (Iraq) • - Ankara (Turkey) • - Antalya (Turkey) • - Antipolo (Philippines) • - Astana (Kazakhstan) • - Astrakhan (Russia) • - Aurangabad (India) • - Bacolod (Philippines) • - Bacoor (Philippines) • - Baghdad (Iraq) • - Baku (Azerbaijan) • - Balikpapan (Indonesia) • - Balıkesir (Turkey) • - Bandarlampung (Indonesia) • - Bandung (Indonesia) • - Bangalore (India) • - Bangkok (Thailand) • - Banjarmasin (Indonesia) • - Bareilly (India) • - Barnaul (Russia) • - Batam (Indonesia) • - Beijing (People's Republic of China) • - Bekasi (Indonesia) • - Bhiwandi (India) • - Bishkek (Kyrgyzstan) • - Bogor (Indonesia) • - Bursa (Turkey) • - Busan (South Korea) • - Cagayan de Oro (Philippines) • - Cairo (Egypt) • - Caloocan (Philippines) • - Cebu City (Philippines) • - Chandigarh (India) • - Changde (People's Republic of China) • - Chelyabinsk (Russia) • - Chennai (India) • - Cheongju (South Korea) • - Chiba (Japan) • - Chongqing (People's Republic of China) • - Cimahi (Indonesia) • - Coimbatore (India) • - Colombo (Sri Lanka) • - Cần Thơ (Vietnam) • - Damascus (Syria) • - Daqing (People's Republic of China) • - Dasmariñas (Philippines) • - Davao City (Philippines) • - Delhi (India) • - Denizli (Turkey) • - Denpasar (Indonesia) • - Depok (Indonesia) • - Dhaka (Bangladesh) • - Doha (Qatar) • - Dubai (United Arab Emirates) • - Dushanbe (Tajikistan) • - Erbil (Iraq) • - Faisalabad (Pakistan) • - Fukuoka (Japan) • - Funabashi (Japan) • - Fuzhou (People's Republic of China) • - Ganja (Azerbaijan) • - Gaza City (Palestine) • - Gaziantep (Turkey) • - General Santos (Philippines) • - George Town (Malaysia) • - Giza (Egypt) • - Goyang (South Korea) • - Gujranwala (Pakistan) • - Guntur (India) • - Hachiōji City (Japan) • - Haiphong (Vietnam) • - Hamamatsu (Japan) • - Hamhung (North Korea) • - Hanoi (Vietnam) • - Hefei (People's Republic of China) • - Helwan (Egypt) • - Higashiōsaka (Japan) • - Himeji (Japan) • - Hiroshima (Japan) • - Ho Chi Minh City (Vietnam) • - Homs (Syria) • - Hyderabad (India) • - Hyderabad (Pakistan) • - Irbid (Jordan) • - Isfahan (Iran) • - Islamabad (Pakistan) • - Istanbul (Turkey) • - Jaipur (India) • - Jakarta (Indonesia) • - Jambi (Indonesia) • - Jeddah (Saudi Arabia) • - Jeonju (South Korea) • - Jerusalem (Israel) • - Jerusalem (Jordan) • - Jerusalem (Palestine) • - Jodhpur (India) • - Kabul (Afghanistan) • - Kagoshima (Japan) • - Kaifeng (People's Republic of China) • - Kaohsiung City (Taiwan) • - Karachi (Pakistan) • - Karaj (Iran) • - Kathmandu (Nepal) • - Kawaguchi (Japan) • - Kawasaki (Japan) • - Kayseri (Turkey) • - Kazan (Russia) • - Kemerovo (Russia) • - Kermanshah (Iran) • - Khabarovsk (Russia) • - Khulna (Bangladesh) • - Kirkuk (Iraq) • - Kitakyūshū (Japan) • - Klang (Malaysia) • - Kolkata (India) • - Krasnoyarsk (Russia) • - Kuala Lumpur (Malaysia) • - Kuantan (Malaysia) • - Kumamoto (Japan) • - Kuwait City (Kuwait) • - Kyoto (Japan) • - Kōbe (Japan) • - Lanzhou (People's Republic of China) • - Las Piñas (Philippines) • - Latakia (Syria) • - Macau (People's Republic of China) • - Makassar (Indonesia) • - Makati (Philippines) • - Makhachkala (Russia) • - Malang (Indonesia) • - Mandalay (Myanmar) • - Manila (Philippines) • - Matsuyama (Japan) • - Mawlamyine (Myanmar) • - Mecca (Saudi Arabia) • - Medan (Indonesia) • - Moscow (Russia) • - Mosul (Iraq) • - Mumbai (India) • - Muntinlupa (Philippines) • - Mysore (India) • - Naberezhnye Chelny (Russia) • - Nagoya (Japan) • - Nantong (People's Republic of China) • - Naypyidaw (Myanmar) • - Niigata (Japan) • - Nizhny Novgorod (Russia) • - Novosibirsk (Russia) • - Okayama (Japan) • - Omsk (Russia) • - Palembang (Indonesia) • - Parañaque (Philippines) • - Pasig (Philippines) • - Pekanbaru (Indonesia) • - Penza (Russia) • - Perm (Russia) • - Peshawar (Pakistan) • - Petaling Jaya (Malaysia) • - Phnom Penh (Cambodia) • - Pohang (South Korea) • - Pontianak (Indonesia) • - Port Said (Egypt) • - Pune (India) • - Pyongyang (North Korea) • - Qiqihar (People's Republic of China) • - Quetta (Pakistan) • - Quezon City (Philippines) • - Ranchi (India) • - Rawalpindi (Pakistan) • - Riyadh (Saudi Arabia) • - Rostov-on-Don (Russia) • - Sagamihara (Japan) • - Saint Petersburg (Russia) • - Saitama (Japan) • - Sakai City (Japan) • - Samara (Russia) • - Samarinda (Indonesia) • - Samarkand (Uzbekistan) • - San Jose del Monte (Philippines) • - Sana'a (Yemen) • - Sapporo (Japan) • - Sargodha (Pakistan) • - Semarang (Indonesia) • - Sendai (Japan) • - Seoul (South Korea) • - Serang (Indonesia) • - Shanghai (People's Republic of China) • - Shantou (People's Republic of China) • - Shaoxing (People's Republic of China) • - Shiraz (Iran) • - Shizuoka (Japan) • - Shubra El-Kheima (Egypt) • - Shymkent (Kazakhstan) • - Sialkot (Pakistan) • - Singapore (Singapore) • - Surabaya (Indonesia) • - Surakarta (Indonesia) • - Ta'izz (Yemen) • - Taguig (Philippines) • - Taipei (Taiwan) • - Tangerang (Indonesia) • - Tangerang Selatan (Indonesia) • - Taoyuan District (Taiwan) • - Tashkent (Uzbekistan) • - Tasikmalaya (Indonesia) • - Tehran (Iran) • - Tianjin (People's Republic of China) • - Tokyo (Japan) • - Tokyo (Japan) • - Tolyatti (Russia) • - Trichy (India) • - Trichy (Tamil Nadu) • - Tyumen (Russia) • - Ufa (Russia) • - Ulaanbaatar (Mongolia) • - Ulsan (South Korea) • - Ulyanovsk (Russia) • - Utsunomiya (Japan) • - Valenzuela (Philippines) • - Varanasi (India) • - Vientiane (Laos) • - Vijayawada (India) • - Visakhapatnam (India) • - Vladivostok (Russia) • - Volgograd (Russia) • - Voronezh (Russia) • - Wenzhou (People's Republic of China) • - Wuhu (People's Republic of China) • - Yancheng (People's Republic of China) • - Yangon (Myanmar) • - Yaroslavl (Russia) • - Yazd (Iran) • - Yekaterinburg (Russia) • - Yokohama (Japan) • - Yongin (South Korea) • - Zamboanga City (Philippines) • - Zhengzhou (People's Republic of China) • - Zibo (People's Republic of China) • - İzmir (Turkey) • - Ōsaka (Japan) -
-
-

Central America

- Emilce nombre unico (Guatemala) • - Guatemala City (Guatemala) • - Havana (Cuba) • - Santiago de Cuba (Cuba) -
-
-

North America

- Acapulco (Mexico) • - Albuquerque (United States of America) • - Austin (United States of America) • - Baltimore (United States of America) • - Boston (United States of America) • - Calgary (Canada) • - Carrefour (Haiti) • - Chicago (United States of America) • - Chihuahua (Mexico) • - Ciudad Nezahualcóyotl (Mexico) • - Columbus (United States of America) • - Culiacán (Mexico) • - Dallas (United States of America) • - Denver (United States of America) • - Detroit (United States of America) • - Ecatepec de Morelos (Mexico) • - Edmonton (Canada) • - El Paso (United States of America) • - Ensenada (Mexico) • - Fort Worth (United States of America) • - Hamilton (Canada) • - Hermosillo (Mexico) • - Houston (United States of America) • - Indianapolis (United States of America) • - Jacksonville (United States of America) • - Kingston (Jamaica) • - Las Vegas (United States of America) • - León (Mexico) • - Los Angeles (United States of America) • - Louisville (United States of America) • - Managua (Nicaragua) • - Memphis (United States of America) • - Mexico City (Mexico) • - Milwaukee (United States of America) • - Mississauga (Canada) • - Monterrey (Mexico) • - Montreal (Canada) • - Nashville (United States of America) • - New York City (United States of America) • - Oklahoma City (United States of America) • - Ottawa (Canada) • - Panama City (Panama) • - Philadelphia (United States of America) • - Phoenix (United States of America) • - Port-au-Prince (Haiti) • - Portland (United States of America) • - Quebec City (Canada) • - San Antonio (United States of America) • - San Diego (United States of America) • - San Francisco (United States of America) • - San Jose (United States of America) • - San Pedro Sula (Honduras) • - San Salvador (El Salvador) • - Santiago de los Caballeros (Dominican Republic) • - Santo Domingo (Dominican Republic) • - Seattle (United States of America) • - Tegucigalpa (Honduras) • - Tlaquepaque (Mexico) • - Toronto (Canada) • - Tucson (United States of America) • - Tultitlán de Mariano Escobedo (Mexico) • - Tuxtla Gutiérrez (Mexico) • - Vancouver (Canada) • - Washington, D.C. (United States of America) • - Winnipeg (Canada) • - Xalapa (Mexico) • - Zapopan (Mexico) -
-
-

Oceania

- Adelaide (Australia) • - Albuquerque (United States of America) • - Auckland (New Zealand) • - Austin (United States of America) • - Baltimore (United States of America) • - Boston (United States of America) • - Brisbane (Australia) • - Chicago (United States of America) • - Columbus (United States of America) • - Dallas (United States of America) • - Denver (United States of America) • - Detroit (United States of America) • - El Paso (United States of America) • - Fort Worth (United States of America) • - Houston (United States of America) • - Indianapolis (United States of America) • - Jacksonville (United States of America) • - Las Vegas (United States of America) • - Los Angeles (United States of America) • - Louisville (United States of America) • - Melbourne (Australia) • - Memphis (United States of America) • - Milwaukee (United States of America) • - Nashville (United States of America) • - New York City (United States of America) • - Oklahoma City (United States of America) • - Perth (Australia) • - Philadelphia (United States of America) • - Phoenix (United States of America) • - Portland (United States of America) • - San Antonio (United States of America) • - San Diego (United States of America) • - San Francisco (United States of America) • - San Jose (United States of America) • - Seattle (United States of America) • - Sydney (Australia) • - Tucson (United States of America) • - Washington, D.C. (United States of America) -
-
-

South America

- Arequipa (Peru) • - Asunción (Paraguay) • - Barquisimeto (Venezuela) • - Belo Horizonte (Brazil) • - Belém (Brazil) • - Bogota (Colombia) • - Brasília (Brazil) • - Buenos Aires (Argentina) • - Cali (Colombia) • - Callao (Peru) • - Campinas (Brazil) • - Chiclayo (Peru) • - Curitiba (Brazil) • - Cúcuta (Venezuela) • - Fortaleza (Brazil) • - Goiânia (Brazil) • - Guarulhos (Brazil) • - Guayaquil (Ecuador) • - La Paz (Bolivia) • - La Plata (Argentina) • - Lima (Peru) • - Maceió (Brazil) • - Manaus (Brazil) • - Mar del Plata (Argentina) • - Maracay (Venezuela) • - Montevideo (Uruguay) • - Osasco (Brazil) • - Panama City (Panama) • - Porto Alegre (Brazil) • - Quito (Ecuador) • - Recife (Brazil) • - Ribeirão Preto (Brazil) • - Rio de Janeiro (Brazil) • - Rosario (Argentina) • - San Miguel de Tucumán (Argentina) • - Santa Cruz (Bolivia) • - Santiago (Chile) • - Santo André (Brazil) • - Sorocaba (Brazil) • - São Bernardo do Campo (Brazil) • - São José dos Campos (Brazil) • - São Luís (Brazil) • - São Paulo (Brazil) • - Trujillo (Peru) • - Uberlândia (Brazil) • - Yurimaguas (Peru) -
-
-
-
-

Language

-
- - - - - - - - - - - - -
- Save -
- -
-
+ +
+ Login +
+
+ +
+
+

Europe

+ Adana (Turkey) • + Almaty (Kazakhstan) • + Amsterdam (Netherlands) • + Ankara (Turkey) • + Antalya (Turkey) • + Astana (Kazakhstan) • + Astrakhan (Russia) • + Athens (Greece) • + Baku (Azerbaijan) • + Balıkesir (Turkey) • + Barcelona (Spain) • + Barnaul (Russia) • + Belgrade (Serbia) • + Berlin (Germany) • + Birmingham (United Kingdom) • + Bratislava (Slovakia) • + Bremen (Germany) • + Brussels (Belgium) • + Bucharest (Romania) • + Budapest (Hungary) • + Bursa (Turkey) • + Chelyabinsk (Russia) • + Chișinău (Moldova) • + Cologne (Germany) • + Copenhagen (Denmark) • + Denizli (Turkey) • + Dnipro (Ukraine) • + Donetsk (Ukraine) • + Dortmund (Germany) • + Dresden (Germany) • + Dublin (Ireland) • + Düsseldorf (Germany) • + Essen (Germany) • + Frankfurt (Germany) • + Free Hanseatic City of Bremen (Germany) • + Ganja (Azerbaijan) • + Gaziantep (Turkey) • + Genoa (Italy) • + Glasgow (United Kingdom) • + Gomel (Belarus) • + Gothenburg (Sweden) • + Hamburg (Germany) • + Hanover (Germany) • + Helsinki (Finland) • + Istanbul (Turkey) • + Kayseri (Turkey) • + Kazan (Russia) • + Kemerovo (Russia) • + Khabarovsk (Russia) • + Kharkiv (Ukraine) • + Kraków (Poland) • + Krasnoyarsk (Russia) • + Kryvyi Rih (Ukraine) • + Kyiv (Ukraine) • + Leeds (United Kingdom) • + Leipzig (Germany) • + Lisbon (Portugal) • + London (United Kingdom) • + Lviv (Ukraine) • + Madrid (Spain) • + Makhachkala (Russia) • + Marseille (France) • + Milan (Italy) • + Minsk (Belarus) • + Moscow (Russia) • + Munich (Germany) • + Málaga (Spain) • + Naberezhnye Chelny (Russia) • + Naples (Italy) • + Nizhny Novgorod (Russia) • + Novosibirsk (Russia) • + Nuremberg (Germany) • + Omsk (Russia) • + Oslo (Norway) • + Palermo (Italy) • + Paris (France) • + Penza (Russia) • + Perm (Russia) • + Poznań (Poland) • + Prague (Czech Republic) • + Riga (Latvia) • + Rome (Italy) • + Rostov-on-Don (Russia) • + Rotterdam (Netherlands) • + Saint Petersburg (Russia) • + Samara (Russia) • + Seville (Spain) • + Sheffield (United Kingdom) • + Shymkent (Kazakhstan) • + Skopje (Republic of Macedonia) • + Sofia (Bulgaria) • + Stockholm (Sweden) • + Stuttgart (Germany) • + Tbilisi (Georgia) • + The Hague (Netherlands) • + Tolyatti (Russia) • + Turin (Italy) • + Tyumen (Russia) • + Ufa (Russia) • + Ulyanovsk (Russia) • + Valencia (Spain) • + Vienna (Austria) • + Vilnius (Lithuania) • + Vladivostok (Russia) • + Volgograd (Russia) • + Voronezh (Russia) • + Warsaw (Poland) • + Wrocław (Poland) • + Yaroslavl (Russia) • + Yekaterinburg (Russia) • + Yerevan (Armenia) • + Zagreb (Croatia) • + Zaporizhzhya (Ukraine) • + Zaragoza (Spain) • + İzmir (Turkey) • + Łódź (Poland) +
+
+

Africa

+ Abeokuta (Nigeria) • + Abidjan (Côte d'Ivoire) • + Abuja (Nigeria) • + Accra (Ghana) • + Addis Ababa (Ethiopia) • + Agadir (Morocco) • + Alexandria (Egypt) • + Algiers (Algeria) • + Antananarivo (Madagascar) • + Asmara (Eritrea) • + Bangui (Central African Republic) • + Benghazi (Libya) • + Blantyre (Malawi) • + Bouaké (Côte d'Ivoire) • + Brazzaville (Republic of the Congo) • + Bujumbura (Burundi) • + Bulawayo (Zimbabwe) • + Cairo (Egypt) • + Conakry (Guinea) • + Dar es Salaam (Tanzania) • + Djibouti (Djibouti) • + Douala (Cameroon) • + Fes (Morocco) • + Freetown (Sierra Leone) • + Giza (Egypt) • + Harare (Zimbabwe) • + Helwan (Egypt) • + Ife (Nigeria) • + Ilorin (Nigeria) • + Johannesburg (South Africa) • + Jos (Nigeria) • + Kaduna (Nigeria) • + Kampala (Uganda) • + Khartoum (Sudan) • + Khartoum North (Sudan) • + Kigali (Rwanda) • + Kinshasa (Democratic Republic of the Congo) • + Kitwe (Zambia) • + Kumasi (Ghana) • + Lagos (Nigeria) • + Libreville (Gabon) • + Lilongwe (Malawi) • + Lomé (Togo) • + Luanda (Angola) • + Lubumbashi (Democratic Republic of the Congo) • + Lusaka (Zambia) • + Maiduguri (Nigeria) • + Maputo (Mozambique) • + Marrakesh (Morocco) • + Matola (Mozambique) • + Mombasa (Kenya) • + Monrovia (Liberia) • + N'Djamena (Chad) • + Nairobi (Kenya) • + Niamey (Niger) • + Nouakchott (Mauritania) • + Ogbomosho (Nigeria) • + Omdurman (Sudan) • + Ouagadougou (Burkina Faso) • + Port Said (Egypt) • + Pretoria (South Africa) • + Rabat (Morocco) • + Sekondi-Takoradi (Ghana) • + Shubra El-Kheima (Egypt) • + Tripoli (Libya) • + Yaoundé (Cameroon) +
+
+

Asia

+ Abu Dhabi (United Arab Emirates) • + Adana (Turkey) • + Aden (Yemen) • + Agartala (India) • + Agra (India) • + Ahvaz (Iran) • + Al Ain (United Arab Emirates) • + Al Hudaydah (Yemen) • + Aleppo (Syria) • + Alexandria (Egypt) • + Almaty (Kazakhstan) • + Amman (Jordan) • + An Najaf (Iraq) • + Ankara (Turkey) • + Antalya (Turkey) • + Antipolo (Philippines) • + Astana (Kazakhstan) • + Astrakhan (Russia) • + Aurangabad (India) • + Bacolod (Philippines) • + Bacoor (Philippines) • + Baghdad (Iraq) • + Baku (Azerbaijan) • + Balikpapan (Indonesia) • + Balıkesir (Turkey) • + Bandarlampung (Indonesia) • + Bandung (Indonesia) • + Bangalore (India) • + Bangkok (Thailand) • + Banjarmasin (Indonesia) • + Bareilly (India) • + Barnaul (Russia) • + Batam (Indonesia) • + Beijing (People's Republic of China) • + Bekasi (Indonesia) • + Bhiwandi (India) • + Bishkek (Kyrgyzstan) • + Bogor (Indonesia) • + Bursa (Turkey) • + Busan (South Korea) • + Cagayan de Oro (Philippines) • + Cairo (Egypt) • + Caloocan (Philippines) • + Cebu City (Philippines) • + Chandigarh (India) • + Changde (People's Republic of China) • + Chelyabinsk (Russia) • + Chennai (India) • + Cheongju (South Korea) • + Chiba (Japan) • + Chongqing (People's Republic of China) • + Cimahi (Indonesia) • + Coimbatore (India) • + Colombo (Sri Lanka) • + Cần Thơ (Vietnam) • + Damascus (Syria) • + Daqing (People's Republic of China) • + Dasmariñas (Philippines) • + Davao City (Philippines) • + Delhi (India) • + Denizli (Turkey) • + Denpasar (Indonesia) • + Depok (Indonesia) • + Dhaka (Bangladesh) • + Doha (Qatar) • + Dubai (United Arab Emirates) • + Dushanbe (Tajikistan) • + Erbil (Iraq) • + Faisalabad (Pakistan) • + Fukuoka (Japan) • + Funabashi (Japan) • + Fuzhou (People's Republic of China) • + Ganja (Azerbaijan) • + Gaza City (Palestine) • + Gaziantep (Turkey) • + General Santos (Philippines) • + George Town (Malaysia) • + Giza (Egypt) • + Goyang (South Korea) • + Gujranwala (Pakistan) • + Guntur (India) • + Hachiōji City (Japan) • + Haiphong (Vietnam) • + Hamamatsu (Japan) • + Hamhung (North Korea) • + Hanoi (Vietnam) • + Hefei (People's Republic of China) • + Helwan (Egypt) • + Higashiōsaka (Japan) • + Himeji (Japan) • + Hiroshima (Japan) • + Ho Chi Minh City (Vietnam) • + Homs (Syria) • + Hyderabad (India) • + Hyderabad (Pakistan) • + Irbid (Jordan) • + Isfahan (Iran) • + Islamabad (Pakistan) • + Istanbul (Turkey) • + Jaipur (India) • + Jakarta (Indonesia) • + Jambi (Indonesia) • + Jeddah (Saudi Arabia) • + Jeonju (South Korea) • + Jerusalem (Israel) • + Jerusalem (Jordan) • + Jerusalem (Palestine) • + Jodhpur (India) • + Kabul (Afghanistan) • + Kagoshima (Japan) • + Kaifeng (People's Republic of China) • + Kaohsiung City (Taiwan) • + Karachi (Pakistan) • + Karaj (Iran) • + Kathmandu (Nepal) • + Kawaguchi (Japan) • + Kawasaki (Japan) • + Kayseri (Turkey) • + Kazan (Russia) • + Kemerovo (Russia) • + Kermanshah (Iran) • + Khabarovsk (Russia) • + Khulna (Bangladesh) • + Kirkuk (Iraq) • + Kitakyūshū (Japan) • + Klang (Malaysia) • + Kolkata (India) • + Krasnoyarsk (Russia) • + Kuala Lumpur (Malaysia) • + Kuantan (Malaysia) • + Kumamoto (Japan) • + Kuwait City (Kuwait) • + Kyoto (Japan) • + Kōbe (Japan) • + Lanzhou (People's Republic of China) • + Las Piñas (Philippines) • + Latakia (Syria) • + Macau (People's Republic of China) • + Makassar (Indonesia) • + Makati (Philippines) • + Makhachkala (Russia) • + Malang (Indonesia) • + Mandalay (Myanmar) • + Manila (Philippines) • + Matsuyama (Japan) • + Mawlamyine (Myanmar) • + Mecca (Saudi Arabia) • + Medan (Indonesia) • + Moscow (Russia) • + Mosul (Iraq) • + Mumbai (India) • + Muntinlupa (Philippines) • + Mysore (India) • + Naberezhnye Chelny (Russia) • + Nagoya (Japan) • + Nantong (People's Republic of China) • + Naypyidaw (Myanmar) • + Niigata (Japan) • + Nizhny Novgorod (Russia) • + Novosibirsk (Russia) • + Okayama (Japan) • + Omsk (Russia) • + Palembang (Indonesia) • + Parañaque (Philippines) • + Pasig (Philippines) • + Pekanbaru (Indonesia) • + Penza (Russia) • + Perm (Russia) • + Peshawar (Pakistan) • + Petaling Jaya (Malaysia) • + Phnom Penh (Cambodia) • + Pohang (South Korea) • + Pontianak (Indonesia) • + Port Said (Egypt) • + Pune (India) • + Pyongyang (North Korea) • + Qiqihar (People's Republic of China) • + Quetta (Pakistan) • + Quezon City (Philippines) • + Ranchi (India) • + Rawalpindi (Pakistan) • + Riyadh (Saudi Arabia) • + Rostov-on-Don (Russia) • + Sagamihara (Japan) • + Saint Petersburg (Russia) • + Saitama (Japan) • + Sakai City (Japan) • + Samara (Russia) • + Samarinda (Indonesia) • + Samarkand (Uzbekistan) • + San Jose del Monte (Philippines) • + Sana'a (Yemen) • + Sapporo (Japan) • + Sargodha (Pakistan) • + Semarang (Indonesia) • + Sendai (Japan) • + Seoul (South Korea) • + Serang (Indonesia) • + Shanghai (People's Republic of China) • + Shantou (People's Republic of China) • + Shaoxing (People's Republic of China) • + Shiraz (Iran) • + Shizuoka (Japan) • + Shubra El-Kheima (Egypt) • + Shymkent (Kazakhstan) • + Sialkot (Pakistan) • + Singapore (Singapore) • + Surabaya (Indonesia) • + Surakarta (Indonesia) • + Ta'izz (Yemen) • + Taguig (Philippines) • + Taipei (Taiwan) • + Tangerang (Indonesia) • + Tangerang Selatan (Indonesia) • + Taoyuan District (Taiwan) • + Tashkent (Uzbekistan) • + Tasikmalaya (Indonesia) • + Tehran (Iran) • + Tianjin (People's Republic of China) • + Tokyo (Japan) • + Tokyo (Japan) • + Tolyatti (Russia) • + Trichy (India) • + Trichy (Tamil Nadu) • + Tyumen (Russia) • + Ufa (Russia) • + Ulaanbaatar (Mongolia) • + Ulsan (South Korea) • + Ulyanovsk (Russia) • + Utsunomiya (Japan) • + Valenzuela (Philippines) • + Varanasi (India) • + Vientiane (Laos) • + Vijayawada (India) • + Visakhapatnam (India) • + Vladivostok (Russia) • + Volgograd (Russia) • + Voronezh (Russia) • + Wenzhou (People's Republic of China) • + Wuhu (People's Republic of China) • + Yancheng (People's Republic of China) • + Yangon (Myanmar) • + Yaroslavl (Russia) • + Yazd (Iran) • + Yekaterinburg (Russia) • + Yokohama (Japan) • + Yongin (South Korea) • + Zamboanga City (Philippines) • + Zhengzhou (People's Republic of China) • + Zibo (People's Republic of China) • + İzmir (Turkey) • + Ōsaka (Japan) +
+
+

Central America

+ Emilce nombre unico (Guatemala) • + Guatemala City (Guatemala) • + Havana (Cuba) • + Santiago de Cuba (Cuba) +
+
+

North America

+ Acapulco (Mexico) • + Albuquerque (United States of America) • + Austin (United States of America) • + Baltimore (United States of America) • + Boston (United States of America) • + Calgary (Canada) • + Carrefour (Haiti) • + Chicago (United States of America) • + Chihuahua (Mexico) • + Ciudad Nezahualcóyotl (Mexico) • + Columbus (United States of America) • + Culiacán (Mexico) • + Dallas (United States of America) • + Denver (United States of America) • + Detroit (United States of America) • + Ecatepec de Morelos (Mexico) • + Edmonton (Canada) • + El Paso (United States of America) • + Ensenada (Mexico) • + Fort Worth (United States of America) • + Hamilton (Canada) • + Hermosillo (Mexico) • + Houston (United States of America) • + Indianapolis (United States of America) • + Jacksonville (United States of America) • + Kingston (Jamaica) • + Las Vegas (United States of America) • + León (Mexico) • + Los Angeles (United States of America) • + Louisville (United States of America) • + Managua (Nicaragua) • + Memphis (United States of America) • + Mexico City (Mexico) • + Milwaukee (United States of America) • + Mississauga (Canada) • + Monterrey (Mexico) • + Montreal (Canada) • + Nashville (United States of America) • + New York City (United States of America) • + Oklahoma City (United States of America) • + Ottawa (Canada) • + Panama City (Panama) • + Philadelphia (United States of America) • + Phoenix (United States of America) • + Port-au-Prince (Haiti) • + Portland (United States of America) • + Quebec City (Canada) • + San Antonio (United States of America) • + San Diego (United States of America) • + San Francisco (United States of America) • + San Jose (United States of America) • + San Pedro Sula (Honduras) • + San Salvador (El Salvador) • + Santiago de los Caballeros (Dominican Republic) • + Santo Domingo (Dominican Republic) • + Seattle (United States of America) • + Tegucigalpa (Honduras) • + Tlaquepaque (Mexico) • + Toronto (Canada) • + Tucson (United States of America) • + Tultitlán de Mariano Escobedo (Mexico) • + Tuxtla Gutiérrez (Mexico) • + Vancouver (Canada) • + Washington, D.C. (United States of America) • + Winnipeg (Canada) • + Xalapa (Mexico) • + Zapopan (Mexico) +
+
+

Oceania

+ Adelaide (Australia) • + Albuquerque (United States of America) • + Auckland (New Zealand) • + Austin (United States of America) • + Baltimore (United States of America) • + Boston (United States of America) • + Brisbane (Australia) • + Chicago (United States of America) • + Columbus (United States of America) • + Dallas (United States of America) • + Denver (United States of America) • + Detroit (United States of America) • + El Paso (United States of America) • + Fort Worth (United States of America) • + Houston (United States of America) • + Indianapolis (United States of America) • + Jacksonville (United States of America) • + Las Vegas (United States of America) • + Los Angeles (United States of America) • + Louisville (United States of America) • + Melbourne (Australia) • + Memphis (United States of America) • + Milwaukee (United States of America) • + Nashville (United States of America) • + New York City (United States of America) • + Oklahoma City (United States of America) • + Perth (Australia) • + Philadelphia (United States of America) • + Phoenix (United States of America) • + Portland (United States of America) • + San Antonio (United States of America) • + San Diego (United States of America) • + San Francisco (United States of America) • + San Jose (United States of America) • + Seattle (United States of America) • + Sydney (Australia) • + Tucson (United States of America) • + Washington, D.C. (United States of America) +
+
+

South America

+ Arequipa (Peru) • + Asunción (Paraguay) • + Barquisimeto (Venezuela) • + Belo Horizonte (Brazil) • + Belém (Brazil) • + Bogota (Colombia) • + Brasília (Brazil) • + Buenos Aires (Argentina) • + Cali (Colombia) • + Callao (Peru) • + Campinas (Brazil) • + Chiclayo (Peru) • + Curitiba (Brazil) • + Cúcuta (Venezuela) • + Fortaleza (Brazil) • + Goiânia (Brazil) • + Guarulhos (Brazil) • + Guayaquil (Ecuador) • + La Paz (Bolivia) • + La Plata (Argentina) • + Lima (Peru) • + Maceió (Brazil) • + Manaus (Brazil) • + Mar del Plata (Argentina) • + Maracay (Venezuela) • + Montevideo (Uruguay) • + Osasco (Brazil) • + Panama City (Panama) • + Porto Alegre (Brazil) • + Quito (Ecuador) • + Recife (Brazil) • + Ribeirão Preto (Brazil) • + Rio de Janeiro (Brazil) • + Rosario (Argentina) • + San Miguel de Tucumán (Argentina) • + Santa Cruz (Bolivia) • + Santiago (Chile) • + Santo André (Brazil) • + Sorocaba (Brazil) • + São Bernardo do Campo (Brazil) • + São José dos Campos (Brazil) • + São Luís (Brazil) • + São Paulo (Brazil) • + Trujillo (Peru) • + Uberlândia (Brazil) • + Yurimaguas (Peru) +
+
+
+
+

Language

+
+ + + + + + + + + + + + +
+ Save +
+ +
+
\ No newline at end of file diff --git a/src/components/main/dashboard/dashboard.js b/src/components/main/dashboard/dashboard.js old mode 100644 new mode 100755 diff --git a/src/components/main/dashboard/dashboard.scss b/src/components/main/dashboard/dashboard.scss old mode 100644 new mode 100755 index efb2e5d..19a3ea0 --- a/src/components/main/dashboard/dashboard.scss +++ b/src/components/main/dashboard/dashboard.scss @@ -1,9 +1,9 @@ -@import '../../../styles/variables'; -@import '../../../styles/responsive'; - -mo-dashboard { - .dashboard { - width: 980px; - max-width: 100%; - } +@import '../../../styles/variables'; +@import '../../../styles/responsive'; + +mo-dashboard { + .dashboard { + width: 980px; + max-width: 100%; + } } \ No newline at end of file diff --git a/src/components/main/list/list.html b/src/components/main/list/list.html old mode 100644 new mode 100755 index fb47139..0da5a57 --- a/src/components/main/list/list.html +++ b/src/components/main/list/list.html @@ -1,69 +1,69 @@ - -
- - Dashboard - - - - - {{item.label}} - {{item.description}} - - -
-
-
- -
- - - {{$ctrl.list.length}} results - Loading... - - -
- {{item.name.value}} -
-
-

{{item.name.value}}

-

{{item.admin.value}}

-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
-
- -
-
+ +
+ + Dashboard + + + + + {{item.label}} + {{item.description}} + + +
+
+
+ +
+ + + {{$ctrl.list.length}} results + Loading... + + +
+ {{item.name.value}} +
+
+

{{item.name.value}}

+

{{item.admin.value}}

+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+
+
+ +
+
\ No newline at end of file diff --git a/src/components/main/list/list.js b/src/components/main/list/list.js old mode 100644 new mode 100755 index 2fc6669..0ce8fcb --- a/src/components/main/list/list.js +++ b/src/components/main/list/list.js @@ -1,140 +1,140 @@ -import _ from 'lodash'; - -import './list.scss'; -import template from './list.html'; -import '../../../images/marker.png'; - -const ListComponent = { - controller: controller, - template: template -}; - -function controller($state, $stateParams, $timeout, leafletData, localStorageService, wikidata) { - let vm = this; - const id = $stateParams.id[0] === 'Q' ? $stateParams.id : 'Q' + $stateParams.id; - - vm.map = {}; - vm.listParams = {}; - - vm.goToItem = (item) => item ? $state.go('main.list', { id: item.id.substring(1) }) : false; - vm.querySearch = (text) => wikidata.getSearch(text); - vm.search = {}; - - const icon = { - iconUrl: 'assets/images/marker.png', - shadowUrl: undefined, - iconSize: [40, 40], - shadowSize: [0, 0], - iconAnchor: [20, 20], - shadowAnchor: [0, 0] - }; - - vm.map = { - center: { - lat: 51.686, - lng: 19.545, - zoom: 7 - }, - markers: {}, - layers: { - baselayers: { - osm: { - name: 'OpenStreetMap', - type: 'xyz', - url: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', - layerOptions: { - subdomains: ['a', 'b', 'c'], - attribution: '© OpenStreetMap contributors', - continuousWorld: true - } - } - }, - overlays: { - monuments: { - name: 'Monuments', - type: 'markercluster', - visible: true - } - } - } - }; - - if (!id || id === 'Q') { - vm.showMap = true; - return; - } - - let langs = $stateParams.lang ? [$stateParams.lang] : []; - langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); - wikidata.setLanguages(langs); - - wikidata.getSearch(id).then(results => { - vm.search.selectedItem = results.length ? results[0] : undefined; - }); - - wikidata.getSPARQL(`SELECT DISTINCT ?item ?itemLabel (SAMPLE(?admin) AS ?admin) (SAMPLE(?adminLabel) AS ?adminLabel) (SAMPLE(?coord) AS ?coord) (SAMPLE(?image) AS ?image) - WHERE { - ?item p:P1435 ?monument . - ?item wdt:P131* wd:` + id + ` . - ?item wdt:P131 ?admin . - ?item wdt:P625 ?coord . - OPTIONAL { ?item wdt:P18 ?image } - OPTIONAL { ?admin rdfs:label ?adminLabel. FILTER(LANG(?adminLabel) = "` + langs[0] + `"). } - SERVICE wikibase:label { bd:serviceParam wikibase:language "` + langs.join(',') + `" } - } - GROUP BY ?item ?itemLabel - ORDER BY ?itemLabel`).then(data => { - // console.log(data) - vm.list = data.map(element => ({ - name: { - value_id: element.item.value.substring(element.item.value.indexOf('/Q') + 1), - value: element.itemLabel.value - }, - admin: { - value_id: element.admin.value.substring(element.admin.value.indexOf('/Q') + 1), - value: element.adminLabel ? element.adminLabel.value : element.admin.value.substring(element.admin.value.indexOf('/Q') + 1) - }, - coord: element.coord.value ? element.coord.value.replace('Point(', '').replace(')', '').split(' ') : false, - image: element.image ? element.image.value.replace('wiki/Special:FilePath', 'w/index.php?title=Special:Redirect/file') + '&width=120' : false - })); - return vm.list; - }).then(list => { - let bounds = []; - list.forEach(element => { - if (element.coord) { - vm.map.markers[element.name.value_id] = { - lat: +element.coord[1], - lng: +element.coord[0], - message: ` - -
- ${element.name.value} -
-
-

${element.name.value}

-

${element.admin.value}

-
-
`, - layer: 'monuments', - icon: icon - }; - bounds.push([+element.coord[1], +element.coord[0]]); - } - }); - $timeout(() => { - vm.showMap = true; - leafletData.getMap().then(function (map) { - if (bounds.length) { - map.fitBounds(bounds, { padding: [25, 25] }); - } - }); - }); - }); -} - -export default () => { - angular - .module('monumental') - .component('moList', ListComponent); -}; +import _ from 'lodash'; + +import './list.scss'; +import template from './list.html'; +import '../../../images/marker.png'; + +const ListComponent = { + controller: controller, + template: template +}; + +function controller($state, $stateParams, $timeout, leafletData, localStorageService, wikidata) { + let vm = this; + const id = $stateParams.id[0] === 'Q' ? $stateParams.id : 'Q' + $stateParams.id; + + vm.map = {}; + vm.listParams = {}; + + vm.goToItem = (item) => item ? $state.go('main.list', { id: item.id.substring(1) }) : false; + vm.querySearch = (text) => wikidata.getSearch(text); + vm.search = {}; + + const icon = { + iconUrl: 'assets/images/marker.png', + shadowUrl: undefined, + iconSize: [40, 40], + shadowSize: [0, 0], + iconAnchor: [20, 20], + shadowAnchor: [0, 0] + }; + + vm.map = { + center: { + lat: 51.686, + lng: 19.545, + zoom: 7 + }, + markers: {}, + layers: { + baselayers: { + osm: { + name: 'OpenStreetMap', + type: 'xyz', + url: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + layerOptions: { + subdomains: ['a', 'b', 'c'], + attribution: '© OpenStreetMap contributors', + continuousWorld: true + } + } + }, + overlays: { + monuments: { + name: 'Monuments', + type: 'markercluster', + visible: true + } + } + } + }; + + if (!id || id === 'Q') { + vm.showMap = true; + return; + } + + let langs = $stateParams.lang ? [$stateParams.lang] : []; + langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); + wikidata.setLanguages(langs); + + wikidata.getSearch(id).then(results => { + vm.search.selectedItem = results.length ? results[0] : undefined; + }); + + wikidata.getSPARQL(`SELECT DISTINCT ?item ?itemLabel (SAMPLE(?admin) AS ?admin) (SAMPLE(?adminLabel) AS ?adminLabel) (SAMPLE(?coord) AS ?coord) (SAMPLE(?image) AS ?image) + WHERE { + ?item p:P1435 ?monument . + ?item wdt:P131* wd:` + id + ` . + ?item wdt:P131 ?admin . + ?item wdt:P625 ?coord . + OPTIONAL { ?item wdt:P18 ?image } + OPTIONAL { ?admin rdfs:label ?adminLabel. FILTER(LANG(?adminLabel) = "` + langs[0] + `"). } + SERVICE wikibase:label { bd:serviceParam wikibase:language "` + langs.join(',') + `" } + } + GROUP BY ?item ?itemLabel + ORDER BY ?itemLabel`).then(data => { + // console.log(data) + vm.list = data.map(element => ({ + name: { + value_id: element.item.value.substring(element.item.value.indexOf('/Q') + 1), + value: element.itemLabel.value + }, + admin: { + value_id: element.admin.value.substring(element.admin.value.indexOf('/Q') + 1), + value: element.adminLabel ? element.adminLabel.value : element.admin.value.substring(element.admin.value.indexOf('/Q') + 1) + }, + coord: element.coord.value ? element.coord.value.replace('Point(', '').replace(')', '').split(' ') : false, + image: element.image ? element.image.value.replace('wiki/Special:FilePath', 'w/index.php?title=Special:Redirect/file') + '&width=120' : false + })); + return vm.list; + }).then(list => { + let bounds = []; + list.forEach(element => { + if (element.coord) { + vm.map.markers[element.name.value_id] = { + lat: +element.coord[1], + lng: +element.coord[0], + message: ` + +
+ ${element.name.value} +
+
+

${element.name.value}

+

${element.admin.value}

+
+
`, + layer: 'monuments', + icon: icon + }; + bounds.push([+element.coord[1], +element.coord[0]]); + } + }); + $timeout(() => { + vm.showMap = true; + leafletData.getMap().then(function (map) { + if (bounds.length) { + map.fitBounds(bounds, { padding: [25, 25] }); + } + }); + }); + }); +} + +export default () => { + angular + .module('monumental') + .component('moList', ListComponent); +}; diff --git a/src/components/main/list/list.scss b/src/components/main/list/list.scss old mode 100644 new mode 100755 index c6c58c9..8652e76 --- a/src/components/main/list/list.scss +++ b/src/components/main/list/list.scss @@ -1,58 +1,58 @@ -@import '../../../styles/variables'; -@import '../../../styles/responsive'; - -mo-list { - .list { - width: 450px; - height: calc(100vh - 105px); - } - - .list__container { - margin-right: 20px; - - md-list-item.md-2-line { - border-bottom: 1px solid $softGrey; - } - } - - .list__image { - width: 75px; - min-width: 75px; - height: 75px; - background: $softGrey; - margin: 15px 15px 15px 0; - - img { - max-width: 100%; - max-height: 100%; - } - } - - .list__map { - background: $softGrey; - - .angular-leaflet-map { - width: 100%; - height: 100%; - } - - .leaflet-popup-close-button { - z-index: 1; - padding: 5px; - } - - .leaflet-popup-content-wrapper { - border-radius: 2px; - } - - .leaflet-popup-content { - min-width: 300px; - margin: 0; - font: 16px Roboto, Arial, sans-serif; - } - } - - md-autocomplete { - margin: 20px; - } +@import '../../../styles/variables'; +@import '../../../styles/responsive'; + +mo-list { + .list { + width: 450px; + height: calc(100vh - 105px); + } + + .list__container { + margin-right: 20px; + + md-list-item.md-2-line { + border-bottom: 1px solid $softGrey; + } + } + + .list__image { + width: 75px; + min-width: 75px; + height: 75px; + background: $softGrey; + margin: 15px 15px 15px 0; + + img { + max-width: 100%; + max-height: 100%; + } + } + + .list__map { + background: $softGrey; + + .angular-leaflet-map { + width: 100%; + height: 100%; + } + + .leaflet-popup-close-button { + z-index: 1; + padding: 5px; + } + + .leaflet-popup-content-wrapper { + border-radius: 2px; + } + + .leaflet-popup-content { + min-width: 300px; + margin: 0; + font: 16px Roboto, Arial, sans-serif; + } + } + + md-autocomplete { + margin: 20px; + } } \ No newline at end of file diff --git a/src/components/main/main.html b/src/components/main/main.html old mode 100644 new mode 100755 diff --git a/src/components/main/main.js b/src/components/main/main.js old mode 100644 new mode 100755 index 1fba5f0..976b767 --- a/src/components/main/main.js +++ b/src/components/main/main.js @@ -1,28 +1,28 @@ -import './main.scss'; -import template from './main.html'; -import pack from '../../../package.json'; - -const MainComponent = { - controller: controller, - template: template -}; - -function controller(wikidata, $state, $stateParams, localStorageService) { - let vm = this; - - let langs = $stateParams.lang ? [$stateParams.lang] : []; - langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); - - vm.lang = langs[0]; - wikidata.setLanguages(langs); - - vm.goToItem = (item) => $state.go('main.object', {id: item.title.substring(1)}); - vm.querySearch = (text) => wikidata.getSearch(text); - vm.search = {}; -} - -export default () => { - angular - .module('monumental') - .component('moMain', MainComponent); -}; +import './main.scss'; +import template from './main.html'; +import pack from '../../../package.json'; + +const MainComponent = { + controller: controller, + template: template +}; + +function controller(wikidata, $state, $stateParams, localStorageService) { + let vm = this; + + let langs = $stateParams.lang ? [$stateParams.lang] : []; + langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); + + vm.lang = langs[0]; + wikidata.setLanguages(langs); + + vm.goToItem = (item) => $state.go('main.object', {id: item.title.substring(1)}); + vm.querySearch = (text) => wikidata.getSearch(text); + vm.search = {}; +} + +export default () => { + angular + .module('monumental') + .component('moMain', MainComponent); +}; diff --git a/src/components/main/main.scss b/src/components/main/main.scss old mode 100644 new mode 100755 index 6e0365a..09284f7 --- a/src/components/main/main.scss +++ b/src/components/main/main.scss @@ -1,18 +1,18 @@ -@import '../../styles/variables'; -@import '../../styles/responsive'; - -.toolbar { - .md-toolbar-tools { - max-width: 980px; - padding: 0; - - md-autocomplete { - width: 300px; - } - } - - &.toolbar--wide .md-toolbar-tools { - max-width: 100%; - padding-left: 15px; - } +@import '../../styles/variables'; +@import '../../styles/responsive'; + +.toolbar { + .md-toolbar-tools { + max-width: 980px; + padding: 0; + + md-autocomplete { + width: 300px; + } + } + + &.toolbar--wide .md-toolbar-tools { + max-width: 100%; + padding-left: 15px; + } } \ No newline at end of file diff --git a/src/components/main/map/map.html b/src/components/main/map/map.html old mode 100644 new mode 100755 index 63572d7..0080b17 --- a/src/components/main/map/map.html +++ b/src/components/main/map/map.html @@ -1,61 +1,61 @@ - -
- - Dashboard - - - - - {{item.label}} - {{item.description}} - - -
-
-
- -
-
-

Zoom in

-
-
- -
-
-

No results

-
- - -
- {{item.name.value}} -
-
-

{{item.name.value}}

-

{{item.admin.value}}

-
-
-
-
-
- -
-
+ +
+ + Dashboard + + + + + {{item.label}} + {{item.description}} + + +
+
+
+ +
+
+

Zoom in

+
+
+ +
+
+

No results

+
+ + +
+ {{item.name.value}} +
+
+

{{item.name.value}}

+

{{item.admin.value}}

+
+
+
+
+
+ +
+
\ No newline at end of file diff --git a/src/components/main/map/map.js b/src/components/main/map/map.js old mode 100644 new mode 100755 index 2fd8cab..828b019 --- a/src/components/main/map/map.js +++ b/src/components/main/map/map.js @@ -1,141 +1,141 @@ -import './map.scss'; -import template from './map.html'; - -const MapComponent = { controller, template }; - -function controller($location, $scope, $state, $stateParams, $timeout, leafletData, localStorageService, mapService, wikidata) { - const vm = this; - const icon = mapService.getMapIcon(); - - // bindings - - vm.goToItem = item => setMap(item); - vm.map = mapService.getMapInstance({ center: { lat: 49.4967, lng: 12.4805, zoom: 4 } }); - vm.querySearch = text => wikidata.getSearch(text); - vm.list = []; - vm.listParams = {}; - vm.loading = false; - vm.loadingMap = true; - vm.search = {}; - - // activate - - let langs = $stateParams.lang ? [$stateParams.lang] : []; - langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); - wikidata.setLanguages(langs); - - $scope.$on('centerUrlHash', (event, centerHash) => { - $location.search({ c: centerHash }); - }); - - $timeout(() => { - vm.loadingMap = false; - leafletData.getMap().then((map) => { - if (map.getZoom() > 12) { - getDataBB(map.getBounds()); - } - map.on('dragend zoomend', () => { - if (map.getZoom() > 12) { - getDataBB(map.getBounds()); - } - }); - }); - }, 100); - - // functions - - function getDataBB(bounds) { - vm.loading = true; - wikidata.getSPARQL(`SELECT ?item ?itemLabel ?admin ?adminLabel ?image ?coord ?heritage WHERE { - SERVICE wikibase:box { - ?item wdt:P625 ?coord . - bd:serviceParam wikibase:cornerWest "Point(${bounds.getSouthWest().lng} ${bounds.getSouthWest().lat})"^^geo:wktLiteral . - bd:serviceParam wikibase:cornerEast "Point(${bounds.getNorthEast().lng} ${bounds.getNorthEast().lat})"^^geo:wktLiteral . - } - OPTIONAL { ?item wdt:P131 ?admin . } - OPTIONAL { ?item wdt:P18 ?image . } - ?item wdt:P1435 ?heritage . - SERVICE wikibase:label { bd:serviceParam wikibase:language "${langs.join(',')}" } - }`).then((data) => { - vm.map.markers = {}; - vm.list = data.map(element => setListElement(element)); - vm.list.forEach((element) => { - vm.map.markers[element.name.value_id] = setMarker(element); - }); - vm.loading = false; - }); - } - - function getImage(image) { - if (image) { - const newImage = image.value.replace('wiki/Special:FilePath', 'w/index.php?title=Special:Redirect/file'); - return `${newImage}&width=120`; - } - return false; - } - - function getMessage(element) { - return ` -
- ${element.name.value} -
-
-

${element.name.value}

-

${element.admin ? element.admin.value : ''}

-
-
`; - } - - function setListElement(element) { - const id = element.item.value; - const obj = { - name: { - value_id: id.substring(id.indexOf('/Q') + 1), - value: element.itemLabel.value, - }, - coord: element.coord.value ? element.coord.value.replace('Point(', '').replace(')', '').split(' ') : false, - image: getImage(element.image), - }; - if (element.admin) { - obj.admin = { - value_id: element.admin.value.substring(element.admin.value.indexOf('/Q') + 1), - value: element.adminLabel ? element.adminLabel.value : element.admin.value.substring(element.admin.value.indexOf('/Q') + 1), - }; - } - return obj; - } - - function setMap(item) { - if (!item || !item.id) { return; } - vm.loading = true; - wikidata.getById(item.id) - .then((data) => { - const element = Object.values(data)[0]; - const coords = element.claims.P625; - if (coords) { - const lat = coords.values[0].value.latitude; - const lng = coords.values[0].value.longitude; - leafletData.getMap().then((map) => { - map.setView([lat, lng], 14); - getDataBB(map.getBounds()); - }); - } - }); - } - - function setMarker(element) { - return { - lat: +element.coord[1], - lng: +element.coord[0], - message: getMessage(element), - layer: 'monuments', - icon, - }; - } -} - -export default () => { - angular - .module('monumental') - .component('moMap', MapComponent); -}; +import './map.scss'; +import template from './map.html'; + +const MapComponent = { controller, template }; + +function controller($location, $scope, $state, $stateParams, $timeout, leafletData, localStorageService, mapService, wikidata) { + const vm = this; + const icon = mapService.getMapIcon(); + + // bindings + + vm.goToItem = item => setMap(item); + vm.map = mapService.getMapInstance({ center: { lat: 49.4967, lng: 12.4805, zoom: 4 } }); + vm.querySearch = text => wikidata.getSearch(text); + vm.list = []; + vm.listParams = {}; + vm.loading = false; + vm.loadingMap = true; + vm.search = {}; + + // activate + + let langs = $stateParams.lang ? [$stateParams.lang] : []; + langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); + wikidata.setLanguages(langs); + + $scope.$on('centerUrlHash', (event, centerHash) => { + $location.search({ c: centerHash }); + }); + + $timeout(() => { + vm.loadingMap = false; + leafletData.getMap().then((map) => { + if (map.getZoom() > 12) { + getDataBB(map.getBounds()); + } + map.on('dragend zoomend', () => { + if (map.getZoom() > 12) { + getDataBB(map.getBounds()); + } + }); + }); + }, 100); + + // functions + + function getDataBB(bounds) { + vm.loading = true; + wikidata.getSPARQL(`SELECT ?item ?itemLabel ?admin ?adminLabel ?image ?coord ?heritage WHERE { + SERVICE wikibase:box { + ?item wdt:P625 ?coord . + bd:serviceParam wikibase:cornerWest "Point(${bounds.getSouthWest().lng} ${bounds.getSouthWest().lat})"^^geo:wktLiteral . + bd:serviceParam wikibase:cornerEast "Point(${bounds.getNorthEast().lng} ${bounds.getNorthEast().lat})"^^geo:wktLiteral . + } + OPTIONAL { ?item wdt:P131 ?admin . } + OPTIONAL { ?item wdt:P18 ?image . } + ?item wdt:P1435 ?heritage . + SERVICE wikibase:label { bd:serviceParam wikibase:language "${langs.join(',')}" } + }`).then((data) => { + vm.map.markers = {}; + vm.list = data.map(element => setListElement(element)); + vm.list.forEach((element) => { + vm.map.markers[element.name.value_id] = setMarker(element); + }); + vm.loading = false; + }); + } + + function getImage(image) { + if (image) { + const newImage = image.value.replace('wiki/Special:FilePath', 'w/index.php?title=Special:Redirect/file'); + return `${newImage}&width=120`; + } + return false; + } + + function getMessage(element) { + return ` +
+ ${element.name.value} +
+
+

${element.name.value}

+

${element.admin ? element.admin.value : ''}

+
+
`; + } + + function setListElement(element) { + const id = element.item.value; + const obj = { + name: { + value_id: id.substring(id.indexOf('/Q') + 1), + value: element.itemLabel.value, + }, + coord: element.coord.value ? element.coord.value.replace('Point(', '').replace(')', '').split(' ') : false, + image: getImage(element.image), + }; + if (element.admin) { + obj.admin = { + value_id: element.admin.value.substring(element.admin.value.indexOf('/Q') + 1), + value: element.adminLabel ? element.adminLabel.value : element.admin.value.substring(element.admin.value.indexOf('/Q') + 1), + }; + } + return obj; + } + + function setMap(item) { + if (!item || !item.id) { return; } + vm.loading = true; + wikidata.getById(item.id) + .then((data) => { + const element = Object.values(data)[0]; + const coords = element.claims.P625; + if (coords) { + const lat = coords.values[0].value.latitude; + const lng = coords.values[0].value.longitude; + leafletData.getMap().then((map) => { + map.setView([lat, lng], 14); + getDataBB(map.getBounds()); + }); + } + }); + } + + function setMarker(element) { + return { + lat: +element.coord[1], + lng: +element.coord[0], + message: getMessage(element), + layer: 'monuments', + icon, + }; + } +} + +export default () => { + angular + .module('monumental') + .component('moMap', MapComponent); +}; diff --git a/src/components/main/map/map.scss b/src/components/main/map/map.scss old mode 100644 new mode 100755 index f907d7a..59be907 --- a/src/components/main/map/map.scss +++ b/src/components/main/map/map.scss @@ -1,87 +1,87 @@ -@import '../../../styles/variables'; -@import '../../../styles/responsive'; - -mo-map { - .list { - position: relative; - width: 450px; - height: calc(100vh - 105px); - } - - .list__container { - margin-right: 20px; - - md-list-item.md-2-line { - border-bottom: 1px solid $softGrey; - } - } - - .list__loading { - position: absolute; - z-index: 10; - width: 100%; - height: 100%; - background: rgba(250,250,250,.8); - padding: 20px; - - md-progress-linear { - max-width: 200px; - } - - &.ng-enter { - transition: 0.3s linear all; - opacity: 0; - } - &.ng-enter.ng-enter-active { - opacity: 1; - } - &.ng-leave { - transition: 0.3s linear all; - opacity: 1; - } - &.ng-leave.ng-leave-active { - opacity: 0; - } - } - - .list__image { - width: 75px; - min-width: 75px; - height: 75px; - background: $softGrey; - margin: 15px 15px 15px 0; - - img { - max-width: 100%; - max-height: 100%; - } - } - - .list__map { - background: $softGrey; - - .angular-leaflet-map { - width: 100%; - height: 100%; - } - - .leaflet-popup-close-button { - z-index: 1; - padding: 5px; - } - - .leaflet-popup-content-wrapper { - border-radius: 2px; - } - - .leaflet-popup-content { - min-width: 300px; - margin: 0; - font: 16px Roboto, Arial, sans-serif; - } - } - - md-autocomplete { - margin: 20px; - } +@import '../../../styles/variables'; +@import '../../../styles/responsive'; + +mo-map { + .list { + position: relative; + width: 450px; + height: calc(100vh - 105px); + } + + .list__container { + margin-right: 20px; + + md-list-item.md-2-line { + border-bottom: 1px solid $softGrey; + } + } + + .list__loading { + position: absolute; + z-index: 10; + width: 100%; + height: 100%; + background: rgba(250,250,250,.8); + padding: 20px; + + md-progress-linear { + max-width: 200px; + } + + &.ng-enter { + transition: 0.3s linear all; + opacity: 0; + } + &.ng-enter.ng-enter-active { + opacity: 1; + } + &.ng-leave { + transition: 0.3s linear all; + opacity: 1; + } + &.ng-leave.ng-leave-active { + opacity: 0; + } + } + + .list__image { + width: 75px; + min-width: 75px; + height: 75px; + background: $softGrey; + margin: 15px 15px 15px 0; + + img { + max-width: 100%; + max-height: 100%; + } + } + + .list__map { + background: $softGrey; + + .angular-leaflet-map { + width: 100%; + height: 100%; + } + + .leaflet-popup-close-button { + z-index: 1; + padding: 5px; + } + + .leaflet-popup-content-wrapper { + border-radius: 2px; + } + + .leaflet-popup-content { + min-width: 300px; + margin: 0; + font: 16px Roboto, Arial, sans-serif; + } + } + + md-autocomplete { + margin: 20px; + } } \ No newline at end of file diff --git a/src/components/main/monument/monument.html b/src/components/main/monument/monument.html old mode 100644 new mode 100755 index a7225d7..2fbf62b --- a/src/components/main/monument/monument.html +++ b/src/components/main/monument/monument.html @@ -1,140 +1,200 @@ - -
- - Dashboard - - - - - {{item.label}} - {{item.description}} - - -
-
-
- -
- - -
-

Loading...

-
- -
-

{{$ctrl.monument.labels[$ctrl.lang] || 'no name'}}

-

{{$ctrl.monument.labels.en || 'no english name'}}

- -
- place - - {{place.value}} · - no location - -
- -
-
-

Wikipedia

- - - {{wiki}} - -
- -
- - Show more - -
- -
-

Properties

-
- {{claim.property[$ctrl.lang]}} - - - {{value.value}} - {{value.value}} - {{value.value.latitude}} / {{value.value.longitude}} - {{value.value.amount}} - {{value.value}} - {{value.value.time.substring(1) | date : 'yyyy'}} - {{value.value}} - {{value.value[$ctrl.lang] || value.value.en}} - - -
-
- - Show raw data - - - Show Wikidata page - -
{{$ctrl.monument | json}}
-
- - -
-
- crop_original -
- - - -
- - - -
- - collections {{$ctrl.monument.claims.P373.property[$ctrl.lang]}} - - - -
- - map Google Maps - - - map OSM - -
-
-
-
-
+ +
+ + Dashboard + + + +
+
+
+
+
+
+
+ + + +
+
+
+
+

{{$ctrl.monument.labels[$ctrl.lang] || 'no name'}}

+

{{$ctrl.monument.labels.en || 'no english name'}}

+
+
+ Upload +
+
+
+
+ place + + + {{place.value}} · + + no location + +
+
+
+ photo + {{$ctrl.images.length || 0}} images +
+
+ description + {{$ctrl.monument.interwikis || 0}} wikis +
+
+ +
+
+
+
+ +
+
+
+

Wikipedia

+ + + {{wiki}} + +
+
+ + Show more + +
+ +
+
+

Properties

+
+ {{claim.property[$ctrl.lang]}} + + + {{value.value}} + {{value.value}} + {{value.value.latitude}} / {{value.value.longitude}} + {{value.value.amount}} + {{value.value}} + {{value.value.time.substring(1) | date : 'yyyy'}} + {{value.value}} + {{value.value[$ctrl.lang] || value.value.en}} + + +
+
+
+
+ + +
+
diff --git a/src/components/main/monument/monument.js b/src/components/main/monument/monument.js old mode 100644 new mode 100755 index 0a3975b..8d15165 --- a/src/components/main/monument/monument.js +++ b/src/components/main/monument/monument.js @@ -97,6 +97,7 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora if (vm.monument.claims.P131) { getFullLocation(claims.P131.values[0].value_id); } + vm.monument.interwikis = Object.keys(vm.monument.interwiki).length; const articleInterwiki = vm.monument.interwiki[`${langs[0]}wiki`] || vm.monument.interwiki[`${langs[1]}wiki`] || vm.monument.interwiki[`${langs[2]}wiki`]; if (articleInterwiki) { getArticleHeader(articleInterwiki.site, articleInterwiki.title); @@ -109,7 +110,7 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora iconSize: [40, 40], shadowSize: [0, 0], iconAnchor: [20, 20], - shadowAnchor: [0, 0] + shadowAnchor: [0, 0], }; vm.map = { diff --git a/src/components/main/monument/monument.scss b/src/components/main/monument/monument.scss old mode 100644 new mode 100755 index bb7e007..b07ac68 --- a/src/components/main/monument/monument.scss +++ b/src/components/main/monument/monument.scss @@ -1,127 +1,141 @@ -@import '../../../styles/variables'; -@import '../../../styles/responsive'; - -mo-monument { - .monument { - width: 980px; - max-width: 100%; - } - - .monument__left { - width: 100%; - margin-right: 50px; - } - - .monument__right { - width: 300px; - min-width: 300px; - overflow: hidden; - - .md-button { - margin-left: 0; - margin-right: 0; - } - } - - .monument__image { - background: #bdbdbd; - width: 300px; - height: 300px; - margin-top: 10px; - - md-icon.material-icons { - width: 60px; - height: 60px; - font-size: 60px; - opacity: .75; - } - } - - .monument__images { - margin-top: 10px; - width: 400px; - - img { - margin-right: 1px; - display: inline-block; - } - } - - .monument__title { - margin-top: 0; - margin-bottom: 0; - } - - .monument__subtitle { - margin-top: 0; - margin-bottom: 15px; - } - - .monument__place { - margin-bottom: 15px; - - .material-icons { - margin-right: 5px; - color: $lightGrey; - } - } - - .monument__article { - margin-top: 30px; - - .article__header { - .md-button.md-primary { - margin-left: 0; - margin-right: 0; - } - } - - .article__text { - position:relative; - max-height: 320px; - overflow: hidden; - font-family: 'Merriweather', serif; - font-size: 15px; - text-align: justify; - line-height: 1.8; - - p:first-child { - margin-top: 0; - } - - &.article__text--long { - max-height: none; - } - - &:after { - content: ""; - position: absolute; top: 0; bottom: 0; left: -15px; right: -15px; - box-shadow: inset rgb(250,250,250) 0 -20px 10px; - } - } - - .md-button { - margin-top: -18px; - } - } - - .monument__details { - .monument__details-item { - margin-bottom: 15px; - - strong { - margin-right: 20px; - } - } - - .monument__details-value { - line-height: 1.5; - } - } - - .angular-leaflet-map { - width: 100%; - height: 300px; - margin-top: 20px; - } +@import '../../../styles/variables'; +@import '../../../styles/responsive'; + +mo-monument { + .monument { + width: 980px; + max-width: 100%; + } + + .monument__header { + padding: 25px; + margin-bottom: 15px; + background: white; + border-bottom: 1px solid $softGrey; + + .monument__primary { + margin-bottom: 20px; + border-bottom: 1px solid $softGrey; + } + .monument__secondary { + .material-icons { + margin-right: 5px; + color: $lightGrey; + } + & > div { + margin-bottom: 15px; + } + } + } + + .monument__image { + width: 300px; + height: 300px; + padding: 5px; + margin-right: 25px; + border: 1px solid $softGrey; + } + + .monument__image-link { + background: $softGrey; + width: 100%; + height: 100%; + + img { + max-width: 100%; + max-height: 100%; + } + } + + .monument__panel { + margin: 15px 0; + padding: 30px; + background: white; + border: 1px solid $softGrey; + border-radius: 2px; + } + + + + + .monument__images { + margin-top: 10px; + width: 400px; + + img { + margin-right: 1px; + display: inline-block; + } + } + + .monument__title { + margin-top: 0; + margin-bottom: 0; + } + + .monument__subtitle { + margin-top: 0; + margin-bottom: 15px; + } + + .monument__place { + margin-bottom: 30px !important; + } + + .monument__article { + .article__header { + .md-button.md-primary { + margin-left: 0; + margin-right: 0; + } + } + + .article__text { + position:relative; + max-height: 320px; + overflow: hidden; + font-family: 'Merriweather', serif; + font-size: 15px; + text-align: justify; + line-height: 1.8; + + p:first-child { + margin-top: 0; + } + + &.article__text--long { + max-height: none; + } + + &:after { + content: ""; + position: absolute; top: 0; bottom: 0; left: -15px; right: -15px; + box-shadow: inset rgb(255,255,255) 0 -20px 10px; + } + } + + .md-button { + margin-top: -18px; + } + } + + .monument__details { + .monument__details-item { + margin-bottom: 15px; + + strong { + margin-right: 20px; + } + } + + .monument__details-value { + line-height: 1.5; + } + } + + .angular-leaflet-map { + width: 100%; + height: 300px; + margin-top: 20px; + } } \ No newline at end of file diff --git a/src/images/marker.png b/src/images/marker.png old mode 100644 new mode 100755 diff --git a/src/index.js b/src/index.js old mode 100644 new mode 100755 index d882af5..86a828e --- a/src/index.js +++ b/src/index.js @@ -101,8 +101,8 @@ function themeConfig($mdThemingProvider, $provide) { tp.alwaysWatchTheme(true); tp.theme('default') - .primaryPalette('moRed') - .accentPalette('blue'); + .primaryPalette('blue') // moRed + .accentPalette('orange'); $provide.value('themeProvider', tp); } diff --git a/src/index_dev.ejs b/src/index_dev.ejs old mode 100644 new mode 100755 index 491963a..d4c1cb3 --- a/src/index_dev.ejs +++ b/src/index_dev.ejs @@ -1,17 +1,17 @@ - - - - - - Monumental - - - - - + + + + + + Monumental + + + + + \ No newline at end of file diff --git a/src/index_local.ejs b/src/index_local.ejs old mode 100644 new mode 100755 index fe95050..aac40a3 --- a/src/index_local.ejs +++ b/src/index_local.ejs @@ -1,17 +1,17 @@ - - - - - - Monumental - - - - - + + + + + + Monumental + + + + + \ No newline at end of file diff --git a/src/services/index.js b/src/services/index.js old mode 100644 new mode 100755 index 3d53019..18b361f --- a/src/services/index.js +++ b/src/services/index.js @@ -1,11 +1,11 @@ -import map from './map.service'; -import theme from './theme.service'; -import wiki from './wiki.service'; -import wikidata from './wikidata.service'; - -export default () => { - map(); - theme(); - wiki(); - wikidata(); -}; +import map from './map.service'; +import theme from './theme.service'; +import wiki from './wiki.service'; +import wikidata from './wikidata.service'; + +export default () => { + map(); + theme(); + wiki(); + wikidata(); +}; diff --git a/src/services/map.service.js b/src/services/map.service.js old mode 100644 new mode 100755 index f3a2055..8e3dd11 --- a/src/services/map.service.js +++ b/src/services/map.service.js @@ -1,67 +1,67 @@ -import '../images/marker.png'; - -const MapService = () => { - const service = { - getMapIcon, - getMapInstance, - }; - - return service; - - // - - function getMapIcon(options) { - return angular.extend({ - iconUrl: 'assets/images/marker.png', - shadowUrl: undefined, - iconSize: [40, 40], - shadowSize: [0, 0], - iconAnchor: [20, 20], - shadowAnchor: [0, 0], - }, options); - } - - function getMapInstance(options) { - return angular.extend({ - center: { - lat: 51.686, - lng: 19.545, - zoom: 7, - }, - markers: {}, - layers: { - baselayers: { - osm: { - name: 'OpenStreetMap', - type: 'xyz', - url: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', - layerOptions: { - subdomains: ['a', 'b', 'c'], - attribution: '© OpenStreetMap contributors', - continuousWorld: true, - }, - }, - }, - overlays: { - monuments: { - name: 'Monuments', - type: 'markercluster', - visible: true, - layerOptions: { - spiderfyOnMaxZoom: false, - showCoverageOnHover: false, - zoomToBoundsOnClick: true, - disableClusteringAtZoom: 17, - }, - }, - }, - }, - }, options); - } -}; - -export default () => { - angular - .module('monumental') - .factory('mapService', MapService); -}; +import '../images/marker.png'; + +const MapService = () => { + const service = { + getMapIcon, + getMapInstance, + }; + + return service; + + // + + function getMapIcon(options) { + return angular.extend({ + iconUrl: 'assets/images/marker.png', + shadowUrl: undefined, + iconSize: [40, 40], + shadowSize: [0, 0], + iconAnchor: [20, 20], + shadowAnchor: [0, 0], + }, options); + } + + function getMapInstance(options) { + return angular.extend({ + center: { + lat: 51.686, + lng: 19.545, + zoom: 7, + }, + markers: {}, + layers: { + baselayers: { + osm: { + name: 'OpenStreetMap', + type: 'xyz', + url: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + layerOptions: { + subdomains: ['a', 'b', 'c'], + attribution: '© OpenStreetMap contributors', + continuousWorld: true, + }, + }, + }, + overlays: { + monuments: { + name: 'Monuments', + type: 'markercluster', + visible: true, + layerOptions: { + spiderfyOnMaxZoom: false, + showCoverageOnHover: false, + zoomToBoundsOnClick: true, + disableClusteringAtZoom: 17, + }, + }, + }, + }, + }, options); + } +}; + +export default () => { + angular + .module('monumental') + .factory('mapService', MapService); +}; diff --git a/src/services/theme.service.js b/src/services/theme.service.js old mode 100644 new mode 100755 index 160e8c3..46fbab3 --- a/src/services/theme.service.js +++ b/src/services/theme.service.js @@ -1,26 +1,26 @@ -const VersionService = function($timeout, $mdTheming, themeProvider) { - const service = { - version: 'default', - getVersion: getVersion, - setVersion: setVersion - }; - - return service; - - //// - - function getVersion() { - return service.version; - } - - function setVersion(version) { - themeProvider.setDefaultTheme(version); - service.version = version; - } -}; - -export default () => { - angular - .module('monumental') - .factory('versionService', VersionService); -}; +const VersionService = function($timeout, $mdTheming, themeProvider) { + const service = { + version: 'default', + getVersion: getVersion, + setVersion: setVersion + }; + + return service; + + //// + + function getVersion() { + return service.version; + } + + function setVersion(version) { + themeProvider.setDefaultTheme(version); + service.version = version; + } +}; + +export default () => { + angular + .module('monumental') + .factory('versionService', VersionService); +}; diff --git a/src/services/wiki.service.js b/src/services/wiki.service.js old mode 100644 new mode 100755 diff --git a/src/services/wikidata.service.js b/src/services/wikidata.service.js old mode 100644 new mode 100755 index 7142010..998a5ab --- a/src/services/wikidata.service.js +++ b/src/services/wikidata.service.js @@ -1,190 +1,190 @@ -const wdService = function ($http, $q) { - - const service = { - getById: getById, - getLabels: getLabels, - getRecursive: getRecursive, - getSearch: getSearch, - getSPARQL: getSPARQL, - setLanguages: setLanguages - }; - - const defaultParams = { - action: 'wbgetentities', - format: 'json', - props: ['info', 'labels', 'aliases', 'descriptions', 'claims', 'datatype', 'sitelinks'], - languages: ['en'], - callback: 'JSON_CALLBACK' - }; - - /** - * Iterates over own enumerable string keyed properties of an object and - * invokes `func` for each property.. - * - * @param {Object} object The object to iterate over - * @param {Function} func The function invoked per iteration - * @returns {Object} Returns `object` - */ - function forOwn(object, func) { - let key; - for (key in object) { - if (!object.hasOwnProperty(key)) { continue; } - func.call(object, object[key], key); - } - return object; - } - - /** - * - * - * @param {Object} data - * @returns {Promise} - */ - function get(data) { - let params = angular.extend({}, defaultParams, data); - return $http.jsonp('https://www.wikidata.org/w/api.php', { - params: mapValues(params, p => angular.isArray(p) ? p.join('|') : p), - cache: false - }); - } - - function getLabels(ids) { - return get({ - ids: ids, - props: ['labels'] - }).then(response => mapValues(response.data.entities, entity => simplifyLabels(entity.labels))); - } - - function getRecursive(element, recursiveProperty) { - let query = `SELECT ?parent ?parentLabel WHERE { - wd:`+ element + ` wdt:` + recursiveProperty + `* ?parent . - SERVICE wikibase:label { bd:serviceParam wikibase:language "` + defaultParams.languages.join(', ') + `" } - }`; - return getSPARQL(query).then(data => { - return data.map(element => ({ - link: element.parent.value.replace('entity', 'wiki'), - value_id: element.parent.value.substring(element.parent.value.indexOf('/Q') + 1), - value: element.parentLabel.value - })); - }); - } - - function getSearch(text) { - return get({ - action: 'wbsearchentities', - search: text, - type: 'item', - language: defaultParams.languages[0] - }).then(data => data.data.search); - } - - function getSPARQL(query) { - return $http.get('https://query.wikidata.org/sparql', { - params: { query: query }, - cache: false - }).then(data => data.data.results.bindings); - } - - /** - * Creates an object with the same keys as `object` and values generated - * by running each own enumerable string keyed property of `object` thru - * `func`. - * - * @param {Object} object The object to iterate over - * @param {Function} func The function invoked per iteration - * @returns {Object} Returns the new mapped object - */ - function mapValues(object, func) { - let key, result = {}; - for (key in object) { - if (!object.hasOwnProperty(key)) { continue; } - result[key] = func.call(object, object[key], key); - } - return result; - } - - function setLanguages(languages) { - defaultParams.languages = languages; - } - - function simplifyAliases(aliases) { - return mapValues(aliases, lang => lang.map(alias => alias.value)); - } - - function simplifyEntity(entity) { - return { - _raw: entity, - id: entity.id, - labels: simplifyLabels(entity.labels), - aliases: simplifyAliases(entity.aliases), - descriptions: simplifyLabels(entity.descriptions), - claims: simplifyClaims(entity.claims), - interwiki: entity.sitelinks - }; - } - - function simplifyLabels(labels) { - return mapValues(labels, label => label.value); - } - - function simplifyClaim(claim) { - const snak = claim.mainsnak; - return { - value_type: snak.datatype, - value_id: snak.datavalue.value.id, - value: snak.datavalue.value, - qualifiers: claim.qualifiers - }; - } - - function simplifyClaims(claims) { - return mapValues(claims, claim => claim.map(simplifyClaim)); - } - - //function getIDs - - function getById(id) { - let entities = {}; - - return get({ - ids: id, - languages: defaultParams.languages - }) - .then(data => mapValues(data.data.entities, entity => simplifyEntity(entity))) - .then(data => { - entities = data; - const simplified = mapValues(data, - entity => mapValues(entity.claims, - claim => claim.map(value => value.value_id))); - let ids = []; - forOwn(simplified, item => { - ids.push.apply(ids, Object.keys(item)); - forOwn(item, prop => ids.push.apply(ids, prop)); - }); - ids = ids.filter((item, pos, self) => item && self.indexOf(item) === pos); - return ids; - }) - .then(labelsIDs => getLabels(labelsIDs)) - .then(labels => { - forOwn(entities, entity => { - entity.claims = mapValues(entity.claims, (values, key) => ({ - property_id: key, - property: labels[key], - values: values.map(value => labels[value.value_id] ? - angular.extend(value, { value: labels[value.value_id] }) : - value), - qualifiers: entity.qualifiers - })); - }); - return entities; - }); - } - - return service; -}; - -export default () => { - angular - .module('monumental') - .factory('wikidata', wdService); +const wdService = function ($http, $q) { + + const service = { + getById: getById, + getLabels: getLabels, + getRecursive: getRecursive, + getSearch: getSearch, + getSPARQL: getSPARQL, + setLanguages: setLanguages + }; + + const defaultParams = { + action: 'wbgetentities', + format: 'json', + props: ['info', 'labels', 'aliases', 'descriptions', 'claims', 'datatype', 'sitelinks'], + languages: ['en'], + callback: 'JSON_CALLBACK' + }; + + /** + * Iterates over own enumerable string keyed properties of an object and + * invokes `func` for each property.. + * + * @param {Object} object The object to iterate over + * @param {Function} func The function invoked per iteration + * @returns {Object} Returns `object` + */ + function forOwn(object, func) { + let key; + for (key in object) { + if (!object.hasOwnProperty(key)) { continue; } + func.call(object, object[key], key); + } + return object; + } + + /** + * + * + * @param {Object} data + * @returns {Promise} + */ + function get(data) { + let params = angular.extend({}, defaultParams, data); + return $http.jsonp('https://www.wikidata.org/w/api.php', { + params: mapValues(params, p => angular.isArray(p) ? p.join('|') : p), + cache: false + }); + } + + function getLabels(ids) { + return get({ + ids: ids, + props: ['labels'] + }).then(response => mapValues(response.data.entities, entity => simplifyLabels(entity.labels))); + } + + function getRecursive(element, recursiveProperty) { + let query = `SELECT ?parent ?parentLabel WHERE { + wd:`+ element + ` wdt:` + recursiveProperty + `* ?parent . + SERVICE wikibase:label { bd:serviceParam wikibase:language "` + defaultParams.languages.join(', ') + `" } + }`; + return getSPARQL(query).then(data => { + return data.map(element => ({ + link: element.parent.value.replace('entity', 'wiki'), + value_id: element.parent.value.substring(element.parent.value.indexOf('/Q') + 1), + value: element.parentLabel.value + })); + }); + } + + function getSearch(text) { + return get({ + action: 'wbsearchentities', + search: text, + type: 'item', + language: defaultParams.languages[0] + }).then(data => data.data.search); + } + + function getSPARQL(query) { + return $http.get('https://query.wikidata.org/sparql', { + params: { query: query }, + cache: false + }).then(data => data.data.results.bindings); + } + + /** + * Creates an object with the same keys as `object` and values generated + * by running each own enumerable string keyed property of `object` thru + * `func`. + * + * @param {Object} object The object to iterate over + * @param {Function} func The function invoked per iteration + * @returns {Object} Returns the new mapped object + */ + function mapValues(object, func) { + let key, result = {}; + for (key in object) { + if (!object.hasOwnProperty(key)) { continue; } + result[key] = func.call(object, object[key], key); + } + return result; + } + + function setLanguages(languages) { + defaultParams.languages = languages; + } + + function simplifyAliases(aliases) { + return mapValues(aliases, lang => lang.map(alias => alias.value)); + } + + function simplifyEntity(entity) { + return { + _raw: entity, + id: entity.id, + labels: simplifyLabels(entity.labels), + aliases: simplifyAliases(entity.aliases), + descriptions: simplifyLabels(entity.descriptions), + claims: simplifyClaims(entity.claims), + interwiki: entity.sitelinks + }; + } + + function simplifyLabels(labels) { + return mapValues(labels, label => label.value); + } + + function simplifyClaim(claim) { + const snak = claim.mainsnak; + return { + value_type: snak.datatype, + value_id: snak.datavalue.value.id, + value: snak.datavalue.value, + qualifiers: claim.qualifiers + }; + } + + function simplifyClaims(claims) { + return mapValues(claims, claim => claim.map(simplifyClaim)); + } + + //function getIDs + + function getById(id) { + let entities = {}; + + return get({ + ids: id, + languages: defaultParams.languages + }) + .then(data => mapValues(data.data.entities, entity => simplifyEntity(entity))) + .then(data => { + entities = data; + const simplified = mapValues(data, + entity => mapValues(entity.claims, + claim => claim.map(value => value.value_id))); + let ids = []; + forOwn(simplified, item => { + ids.push.apply(ids, Object.keys(item)); + forOwn(item, prop => ids.push.apply(ids, prop)); + }); + ids = ids.filter((item, pos, self) => item && self.indexOf(item) === pos); + return ids; + }) + .then(labelsIDs => getLabels(labelsIDs)) + .then(labels => { + forOwn(entities, entity => { + entity.claims = mapValues(entity.claims, (values, key) => ({ + property_id: key, + property: labels[key], + values: values.map(value => labels[value.value_id] ? + angular.extend(value, { value: labels[value.value_id] }) : + value), + qualifiers: entity.qualifiers + })); + }); + return entities; + }); + } + + return service; +}; + +export default () => { + angular + .module('monumental') + .factory('wikidata', wdService); }; \ No newline at end of file diff --git a/src/styles/_general.scss b/src/styles/_general.scss old mode 100644 new mode 100755 index deb0ae9..849cc93 --- a/src/styles/_general.scss +++ b/src/styles/_general.scss @@ -1,79 +1,87 @@ -@import 'variables'; - -html, body { - width: 100%; - height: 100%; -} - -body { - color: $darkGrey; - font: 16px Roboto, Arial, sans-serif; -} - -::-webkit-scrollbar { - width: 5px; - background: transparent; -} -::-webkit-scrollbar-thumb { - background: rgba(0,0,0,0.2); -} - -md-content { - margin: 20px; -} - -.container { - min-height: calc(100vh - 64px); - - ui-view, ui-view > * { - width: 100%; - } -} - -//// - -.link { - cursor: pointer; -} - -a, a.link { - cursor: pointer; - color: #8f0000; - text-decoration: none; -} - -.muted { - color: $lightGrey; -} - -.full-width { - width: 100%; -} - -.text-left { - text-align: left; -} - -.text-right { - text-align: right; -} - -.invisible { - width: 0; - height: 0; - opacity: 0; -} - -strong { - font-weight: 500; -} - -//// - -.toolbar { - padding: 0 5px; -} - -.md-virtual-repeat-container.md-autocomplete-suggestions-container { - z-index: 1000 !important; +@import 'variables'; + +html, body { + width: 100%; + height: 100%; +} + +body { + color: $darkGrey; + font: 16px Roboto, Arial, sans-serif; +} + +::-webkit-scrollbar { + width: 5px; + background: transparent; +} +::-webkit-scrollbar-thumb { + background: rgba(0,0,0,0.2); +} + +md-content { + margin: 20px; + background: transparent; +} + +.container { + min-height: calc(100vh - 64px); + + ui-view, ui-view > * { + width: 100%; + } +} + +//// + +.link { + cursor: pointer; +} + +a, a.link { + cursor: pointer; + color: rgb(33,150,243); + text-decoration: none; +} + +.muted { + color: $lightGrey; +} + +.full-width { + width: 100%; +} + +.text-left { + text-align: left; +} + +.text-right { + text-align: right; +} + +.invisible { + width: 0; + height: 0; + opacity: 0; +} + +strong { + font-weight: 500; +} + +//// + +.toolbar { + padding: 0 5px; + min-height: 54px; + max-height: 54px; + + .md-toolbar-tools { + max-height: 54px; + height: 54px; + } +} + +.md-virtual-repeat-container.md-autocomplete-suggestions-container { + z-index: 1000 !important; } \ No newline at end of file diff --git a/src/styles/_responsive.scss b/src/styles/_responsive.scss old mode 100644 new mode 100755 index 6225702..30b2e31 --- a/src/styles/_responsive.scss +++ b/src/styles/_responsive.scss @@ -1,20 +1,20 @@ -$small: 960px; -$large: 1280px; - -@mixin small { - @media (max-width: #{$small - 1px}) { - @content; - } -} - -@mixin medium { - @media (min-width: #{$small}) and (max-width: #{$large - 1px}) { - @content; - } -} - -@mixin large { - @media (min-width: #{$large}) { - @content; - } +$small: 960px; +$large: 1280px; + +@mixin small { + @media (max-width: #{$small - 1px}) { + @content; + } +} + +@mixin medium { + @media (min-width: #{$small}) and (max-width: #{$large - 1px}) { + @content; + } +} + +@mixin large { + @media (min-width: #{$large}) { + @content; + } } \ No newline at end of file diff --git a/src/styles/_variables.scss b/src/styles/_variables.scss old mode 100644 new mode 100755 index ce98f24..7b24a55 --- a/src/styles/_variables.scss +++ b/src/styles/_variables.scss @@ -1,3 +1,3 @@ -$softGrey: #e5e5e5; -$lightGrey: rgba(0,0,0,0.54); +$softGrey: #e5e5e5; +$lightGrey: rgba(0,0,0,0.34); $darkGrey: rgba(0,0,0,.87); \ No newline at end of file diff --git a/src/styles/style.scss b/src/styles/style.scss old mode 100644 new mode 100755 index 3016a55..22ddf95 --- a/src/styles/style.scss +++ b/src/styles/style.scss @@ -1,5 +1,5 @@ -@import url('https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&subset=latin,latin-ext'); -@import url('https://fonts.googleapis.com/css?family=Merriweather&subset=cyrillic,cyrillic-ext,latin-ext'); - -@import 'general'; +@import url('https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&subset=latin,latin-ext'); +@import url('https://fonts.googleapis.com/css?family=Merriweather&subset=cyrillic,cyrillic-ext,latin-ext'); + +@import 'general'; @import 'variables'; \ No newline at end of file From 0746518a292b02697513e4d7268736c2d213dc4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Thu, 16 Mar 2017 18:00:32 +0100 Subject: [PATCH 04/47] chore(app): code lint --- src/components/main/dashboard/dashboard.html | 1302 +++++++++--------- src/components/main/dashboard/dashboard.js | 4 +- src/components/main/dashboard/dashboard.scss | 16 +- src/components/main/list/list.html | 136 +- src/components/main/list/list.js | 275 ++-- src/components/main/list/list.scss | 114 +- src/components/main/main.js | 53 +- src/components/main/main.scss | 34 +- src/components/main/map/map.html | 120 +- src/components/main/map/map.js | 286 ++-- src/components/main/map/map.scss | 172 +-- src/components/main/monument/monument.html | 400 +++--- src/components/main/monument/monument.js | 30 +- src/components/main/monument/monument.scss | 280 ++-- src/services/index.js | 22 +- src/services/map.service.js | 134 +- src/services/theme.service.js | 52 +- src/services/wiki.service.js | 34 +- 18 files changed, 1731 insertions(+), 1733 deletions(-) diff --git a/src/components/main/dashboard/dashboard.html b/src/components/main/dashboard/dashboard.html index 805a369..91ba722 100755 --- a/src/components/main/dashboard/dashboard.html +++ b/src/components/main/dashboard/dashboard.html @@ -1,652 +1,652 @@ - -
- Login -
-
- -
-
-

Europe

- Adana (Turkey) • - Almaty (Kazakhstan) • - Amsterdam (Netherlands) • - Ankara (Turkey) • - Antalya (Turkey) • - Astana (Kazakhstan) • - Astrakhan (Russia) • - Athens (Greece) • - Baku (Azerbaijan) • - Balıkesir (Turkey) • - Barcelona (Spain) • - Barnaul (Russia) • - Belgrade (Serbia) • - Berlin (Germany) • - Birmingham (United Kingdom) • - Bratislava (Slovakia) • - Bremen (Germany) • - Brussels (Belgium) • - Bucharest (Romania) • - Budapest (Hungary) • - Bursa (Turkey) • - Chelyabinsk (Russia) • - Chișinău (Moldova) • - Cologne (Germany) • - Copenhagen (Denmark) • - Denizli (Turkey) • - Dnipro (Ukraine) • - Donetsk (Ukraine) • - Dortmund (Germany) • - Dresden (Germany) • - Dublin (Ireland) • - Düsseldorf (Germany) • - Essen (Germany) • - Frankfurt (Germany) • - Free Hanseatic City of Bremen (Germany) • - Ganja (Azerbaijan) • - Gaziantep (Turkey) • - Genoa (Italy) • - Glasgow (United Kingdom) • - Gomel (Belarus) • - Gothenburg (Sweden) • - Hamburg (Germany) • - Hanover (Germany) • - Helsinki (Finland) • - Istanbul (Turkey) • - Kayseri (Turkey) • - Kazan (Russia) • - Kemerovo (Russia) • - Khabarovsk (Russia) • - Kharkiv (Ukraine) • - Kraków (Poland) • - Krasnoyarsk (Russia) • - Kryvyi Rih (Ukraine) • - Kyiv (Ukraine) • - Leeds (United Kingdom) • - Leipzig (Germany) • - Lisbon (Portugal) • - London (United Kingdom) • - Lviv (Ukraine) • - Madrid (Spain) • - Makhachkala (Russia) • - Marseille (France) • - Milan (Italy) • - Minsk (Belarus) • - Moscow (Russia) • - Munich (Germany) • - Málaga (Spain) • - Naberezhnye Chelny (Russia) • - Naples (Italy) • - Nizhny Novgorod (Russia) • - Novosibirsk (Russia) • - Nuremberg (Germany) • - Omsk (Russia) • - Oslo (Norway) • - Palermo (Italy) • - Paris (France) • - Penza (Russia) • - Perm (Russia) • - Poznań (Poland) • - Prague (Czech Republic) • - Riga (Latvia) • - Rome (Italy) • - Rostov-on-Don (Russia) • - Rotterdam (Netherlands) • - Saint Petersburg (Russia) • - Samara (Russia) • - Seville (Spain) • - Sheffield (United Kingdom) • - Shymkent (Kazakhstan) • - Skopje (Republic of Macedonia) • - Sofia (Bulgaria) • - Stockholm (Sweden) • - Stuttgart (Germany) • - Tbilisi (Georgia) • - The Hague (Netherlands) • - Tolyatti (Russia) • - Turin (Italy) • - Tyumen (Russia) • - Ufa (Russia) • - Ulyanovsk (Russia) • - Valencia (Spain) • - Vienna (Austria) • - Vilnius (Lithuania) • - Vladivostok (Russia) • - Volgograd (Russia) • - Voronezh (Russia) • - Warsaw (Poland) • - Wrocław (Poland) • - Yaroslavl (Russia) • - Yekaterinburg (Russia) • - Yerevan (Armenia) • - Zagreb (Croatia) • - Zaporizhzhya (Ukraine) • - Zaragoza (Spain) • - İzmir (Turkey) • - Łódź (Poland) -
-
-

Africa

- Abeokuta (Nigeria) • - Abidjan (Côte d'Ivoire) • - Abuja (Nigeria) • - Accra (Ghana) • - Addis Ababa (Ethiopia) • - Agadir (Morocco) • - Alexandria (Egypt) • - Algiers (Algeria) • - Antananarivo (Madagascar) • - Asmara (Eritrea) • - Bangui (Central African Republic) • - Benghazi (Libya) • - Blantyre (Malawi) • - Bouaké (Côte d'Ivoire) • - Brazzaville (Republic of the Congo) • - Bujumbura (Burundi) • - Bulawayo (Zimbabwe) • - Cairo (Egypt) • - Conakry (Guinea) • - Dar es Salaam (Tanzania) • - Djibouti (Djibouti) • - Douala (Cameroon) • - Fes (Morocco) • - Freetown (Sierra Leone) • - Giza (Egypt) • - Harare (Zimbabwe) • - Helwan (Egypt) • - Ife (Nigeria) • - Ilorin (Nigeria) • - Johannesburg (South Africa) • - Jos (Nigeria) • - Kaduna (Nigeria) • - Kampala (Uganda) • - Khartoum (Sudan) • - Khartoum North (Sudan) • - Kigali (Rwanda) • - Kinshasa (Democratic Republic of the Congo) • - Kitwe (Zambia) • - Kumasi (Ghana) • - Lagos (Nigeria) • - Libreville (Gabon) • - Lilongwe (Malawi) • - Lomé (Togo) • - Luanda (Angola) • - Lubumbashi (Democratic Republic of the Congo) • - Lusaka (Zambia) • - Maiduguri (Nigeria) • - Maputo (Mozambique) • - Marrakesh (Morocco) • - Matola (Mozambique) • - Mombasa (Kenya) • - Monrovia (Liberia) • - N'Djamena (Chad) • - Nairobi (Kenya) • - Niamey (Niger) • - Nouakchott (Mauritania) • - Ogbomosho (Nigeria) • - Omdurman (Sudan) • - Ouagadougou (Burkina Faso) • - Port Said (Egypt) • - Pretoria (South Africa) • - Rabat (Morocco) • - Sekondi-Takoradi (Ghana) • - Shubra El-Kheima (Egypt) • - Tripoli (Libya) • - Yaoundé (Cameroon) -
-
-

Asia

- Abu Dhabi (United Arab Emirates) • - Adana (Turkey) • - Aden (Yemen) • - Agartala (India) • - Agra (India) • - Ahvaz (Iran) • - Al Ain (United Arab Emirates) • - Al Hudaydah (Yemen) • - Aleppo (Syria) • - Alexandria (Egypt) • - Almaty (Kazakhstan) • - Amman (Jordan) • - An Najaf (Iraq) • - Ankara (Turkey) • - Antalya (Turkey) • - Antipolo (Philippines) • - Astana (Kazakhstan) • - Astrakhan (Russia) • - Aurangabad (India) • - Bacolod (Philippines) • - Bacoor (Philippines) • - Baghdad (Iraq) • - Baku (Azerbaijan) • - Balikpapan (Indonesia) • - Balıkesir (Turkey) • - Bandarlampung (Indonesia) • - Bandung (Indonesia) • - Bangalore (India) • - Bangkok (Thailand) • - Banjarmasin (Indonesia) • - Bareilly (India) • - Barnaul (Russia) • - Batam (Indonesia) • - Beijing (People's Republic of China) • - Bekasi (Indonesia) • - Bhiwandi (India) • - Bishkek (Kyrgyzstan) • - Bogor (Indonesia) • - Bursa (Turkey) • - Busan (South Korea) • - Cagayan de Oro (Philippines) • - Cairo (Egypt) • - Caloocan (Philippines) • - Cebu City (Philippines) • - Chandigarh (India) • - Changde (People's Republic of China) • - Chelyabinsk (Russia) • - Chennai (India) • - Cheongju (South Korea) • - Chiba (Japan) • - Chongqing (People's Republic of China) • - Cimahi (Indonesia) • - Coimbatore (India) • - Colombo (Sri Lanka) • - Cần Thơ (Vietnam) • - Damascus (Syria) • - Daqing (People's Republic of China) • - Dasmariñas (Philippines) • - Davao City (Philippines) • - Delhi (India) • - Denizli (Turkey) • - Denpasar (Indonesia) • - Depok (Indonesia) • - Dhaka (Bangladesh) • - Doha (Qatar) • - Dubai (United Arab Emirates) • - Dushanbe (Tajikistan) • - Erbil (Iraq) • - Faisalabad (Pakistan) • - Fukuoka (Japan) • - Funabashi (Japan) • - Fuzhou (People's Republic of China) • - Ganja (Azerbaijan) • - Gaza City (Palestine) • - Gaziantep (Turkey) • - General Santos (Philippines) • - George Town (Malaysia) • - Giza (Egypt) • - Goyang (South Korea) • - Gujranwala (Pakistan) • - Guntur (India) • - Hachiōji City (Japan) • - Haiphong (Vietnam) • - Hamamatsu (Japan) • - Hamhung (North Korea) • - Hanoi (Vietnam) • - Hefei (People's Republic of China) • - Helwan (Egypt) • - Higashiōsaka (Japan) • - Himeji (Japan) • - Hiroshima (Japan) • - Ho Chi Minh City (Vietnam) • - Homs (Syria) • - Hyderabad (India) • - Hyderabad (Pakistan) • - Irbid (Jordan) • - Isfahan (Iran) • - Islamabad (Pakistan) • - Istanbul (Turkey) • - Jaipur (India) • - Jakarta (Indonesia) • - Jambi (Indonesia) • - Jeddah (Saudi Arabia) • - Jeonju (South Korea) • - Jerusalem (Israel) • - Jerusalem (Jordan) • - Jerusalem (Palestine) • - Jodhpur (India) • - Kabul (Afghanistan) • - Kagoshima (Japan) • - Kaifeng (People's Republic of China) • - Kaohsiung City (Taiwan) • - Karachi (Pakistan) • - Karaj (Iran) • - Kathmandu (Nepal) • - Kawaguchi (Japan) • - Kawasaki (Japan) • - Kayseri (Turkey) • - Kazan (Russia) • - Kemerovo (Russia) • - Kermanshah (Iran) • - Khabarovsk (Russia) • - Khulna (Bangladesh) • - Kirkuk (Iraq) • - Kitakyūshū (Japan) • - Klang (Malaysia) • - Kolkata (India) • - Krasnoyarsk (Russia) • - Kuala Lumpur (Malaysia) • - Kuantan (Malaysia) • - Kumamoto (Japan) • - Kuwait City (Kuwait) • - Kyoto (Japan) • - Kōbe (Japan) • - Lanzhou (People's Republic of China) • - Las Piñas (Philippines) • - Latakia (Syria) • - Macau (People's Republic of China) • - Makassar (Indonesia) • - Makati (Philippines) • - Makhachkala (Russia) • - Malang (Indonesia) • - Mandalay (Myanmar) • - Manila (Philippines) • - Matsuyama (Japan) • - Mawlamyine (Myanmar) • - Mecca (Saudi Arabia) • - Medan (Indonesia) • - Moscow (Russia) • - Mosul (Iraq) • - Mumbai (India) • - Muntinlupa (Philippines) • - Mysore (India) • - Naberezhnye Chelny (Russia) • - Nagoya (Japan) • - Nantong (People's Republic of China) • - Naypyidaw (Myanmar) • - Niigata (Japan) • - Nizhny Novgorod (Russia) • - Novosibirsk (Russia) • - Okayama (Japan) • - Omsk (Russia) • - Palembang (Indonesia) • - Parañaque (Philippines) • - Pasig (Philippines) • - Pekanbaru (Indonesia) • - Penza (Russia) • - Perm (Russia) • - Peshawar (Pakistan) • - Petaling Jaya (Malaysia) • - Phnom Penh (Cambodia) • - Pohang (South Korea) • - Pontianak (Indonesia) • - Port Said (Egypt) • - Pune (India) • - Pyongyang (North Korea) • - Qiqihar (People's Republic of China) • - Quetta (Pakistan) • - Quezon City (Philippines) • - Ranchi (India) • - Rawalpindi (Pakistan) • - Riyadh (Saudi Arabia) • - Rostov-on-Don (Russia) • - Sagamihara (Japan) • - Saint Petersburg (Russia) • - Saitama (Japan) • - Sakai City (Japan) • - Samara (Russia) • - Samarinda (Indonesia) • - Samarkand (Uzbekistan) • - San Jose del Monte (Philippines) • - Sana'a (Yemen) • - Sapporo (Japan) • - Sargodha (Pakistan) • - Semarang (Indonesia) • - Sendai (Japan) • - Seoul (South Korea) • - Serang (Indonesia) • - Shanghai (People's Republic of China) • - Shantou (People's Republic of China) • - Shaoxing (People's Republic of China) • - Shiraz (Iran) • - Shizuoka (Japan) • - Shubra El-Kheima (Egypt) • - Shymkent (Kazakhstan) • - Sialkot (Pakistan) • - Singapore (Singapore) • - Surabaya (Indonesia) • - Surakarta (Indonesia) • - Ta'izz (Yemen) • - Taguig (Philippines) • - Taipei (Taiwan) • - Tangerang (Indonesia) • - Tangerang Selatan (Indonesia) • - Taoyuan District (Taiwan) • - Tashkent (Uzbekistan) • - Tasikmalaya (Indonesia) • - Tehran (Iran) • - Tianjin (People's Republic of China) • - Tokyo (Japan) • - Tokyo (Japan) • - Tolyatti (Russia) • - Trichy (India) • - Trichy (Tamil Nadu) • - Tyumen (Russia) • - Ufa (Russia) • - Ulaanbaatar (Mongolia) • - Ulsan (South Korea) • - Ulyanovsk (Russia) • - Utsunomiya (Japan) • - Valenzuela (Philippines) • - Varanasi (India) • - Vientiane (Laos) • - Vijayawada (India) • - Visakhapatnam (India) • - Vladivostok (Russia) • - Volgograd (Russia) • - Voronezh (Russia) • - Wenzhou (People's Republic of China) • - Wuhu (People's Republic of China) • - Yancheng (People's Republic of China) • - Yangon (Myanmar) • - Yaroslavl (Russia) • - Yazd (Iran) • - Yekaterinburg (Russia) • - Yokohama (Japan) • - Yongin (South Korea) • - Zamboanga City (Philippines) • - Zhengzhou (People's Republic of China) • - Zibo (People's Republic of China) • - İzmir (Turkey) • - Ōsaka (Japan) -
-
-

Central America

- Emilce nombre unico (Guatemala) • - Guatemala City (Guatemala) • - Havana (Cuba) • - Santiago de Cuba (Cuba) -
-
-

North America

- Acapulco (Mexico) • - Albuquerque (United States of America) • - Austin (United States of America) • - Baltimore (United States of America) • - Boston (United States of America) • - Calgary (Canada) • - Carrefour (Haiti) • - Chicago (United States of America) • - Chihuahua (Mexico) • - Ciudad Nezahualcóyotl (Mexico) • - Columbus (United States of America) • - Culiacán (Mexico) • - Dallas (United States of America) • - Denver (United States of America) • - Detroit (United States of America) • - Ecatepec de Morelos (Mexico) • - Edmonton (Canada) • - El Paso (United States of America) • - Ensenada (Mexico) • - Fort Worth (United States of America) • - Hamilton (Canada) • - Hermosillo (Mexico) • - Houston (United States of America) • - Indianapolis (United States of America) • - Jacksonville (United States of America) • - Kingston (Jamaica) • - Las Vegas (United States of America) • - León (Mexico) • - Los Angeles (United States of America) • - Louisville (United States of America) • - Managua (Nicaragua) • - Memphis (United States of America) • - Mexico City (Mexico) • - Milwaukee (United States of America) • - Mississauga (Canada) • - Monterrey (Mexico) • - Montreal (Canada) • - Nashville (United States of America) • - New York City (United States of America) • - Oklahoma City (United States of America) • - Ottawa (Canada) • - Panama City (Panama) • - Philadelphia (United States of America) • - Phoenix (United States of America) • - Port-au-Prince (Haiti) • - Portland (United States of America) • - Quebec City (Canada) • - San Antonio (United States of America) • - San Diego (United States of America) • - San Francisco (United States of America) • - San Jose (United States of America) • - San Pedro Sula (Honduras) • - San Salvador (El Salvador) • - Santiago de los Caballeros (Dominican Republic) • - Santo Domingo (Dominican Republic) • - Seattle (United States of America) • - Tegucigalpa (Honduras) • - Tlaquepaque (Mexico) • - Toronto (Canada) • - Tucson (United States of America) • - Tultitlán de Mariano Escobedo (Mexico) • - Tuxtla Gutiérrez (Mexico) • - Vancouver (Canada) • - Washington, D.C. (United States of America) • - Winnipeg (Canada) • - Xalapa (Mexico) • - Zapopan (Mexico) -
-
-

Oceania

- Adelaide (Australia) • - Albuquerque (United States of America) • - Auckland (New Zealand) • - Austin (United States of America) • - Baltimore (United States of America) • - Boston (United States of America) • - Brisbane (Australia) • - Chicago (United States of America) • - Columbus (United States of America) • - Dallas (United States of America) • - Denver (United States of America) • - Detroit (United States of America) • - El Paso (United States of America) • - Fort Worth (United States of America) • - Houston (United States of America) • - Indianapolis (United States of America) • - Jacksonville (United States of America) • - Las Vegas (United States of America) • - Los Angeles (United States of America) • - Louisville (United States of America) • - Melbourne (Australia) • - Memphis (United States of America) • - Milwaukee (United States of America) • - Nashville (United States of America) • - New York City (United States of America) • - Oklahoma City (United States of America) • - Perth (Australia) • - Philadelphia (United States of America) • - Phoenix (United States of America) • - Portland (United States of America) • - San Antonio (United States of America) • - San Diego (United States of America) • - San Francisco (United States of America) • - San Jose (United States of America) • - Seattle (United States of America) • - Sydney (Australia) • - Tucson (United States of America) • - Washington, D.C. (United States of America) -
-
-

South America

- Arequipa (Peru) • - Asunción (Paraguay) • - Barquisimeto (Venezuela) • - Belo Horizonte (Brazil) • - Belém (Brazil) • - Bogota (Colombia) • - Brasília (Brazil) • - Buenos Aires (Argentina) • - Cali (Colombia) • - Callao (Peru) • - Campinas (Brazil) • - Chiclayo (Peru) • - Curitiba (Brazil) • - Cúcuta (Venezuela) • - Fortaleza (Brazil) • - Goiânia (Brazil) • - Guarulhos (Brazil) • - Guayaquil (Ecuador) • - La Paz (Bolivia) • - La Plata (Argentina) • - Lima (Peru) • - Maceió (Brazil) • - Manaus (Brazil) • - Mar del Plata (Argentina) • - Maracay (Venezuela) • - Montevideo (Uruguay) • - Osasco (Brazil) • - Panama City (Panama) • - Porto Alegre (Brazil) • - Quito (Ecuador) • - Recife (Brazil) • - Ribeirão Preto (Brazil) • - Rio de Janeiro (Brazil) • - Rosario (Argentina) • - San Miguel de Tucumán (Argentina) • - Santa Cruz (Bolivia) • - Santiago (Chile) • - Santo André (Brazil) • - Sorocaba (Brazil) • - São Bernardo do Campo (Brazil) • - São José dos Campos (Brazil) • - São Luís (Brazil) • - São Paulo (Brazil) • - Trujillo (Peru) • - Uberlândia (Brazil) • - Yurimaguas (Peru) -
-
-
-
-

Language

-
- - - - - - - - - - - - -
- Save -
- -
-
+ +
+ Login +
+
+ +
+
+

Europe

+ Adana (Turkey) • + Almaty (Kazakhstan) • + Amsterdam (Netherlands) • + Ankara (Turkey) • + Antalya (Turkey) • + Astana (Kazakhstan) • + Astrakhan (Russia) • + Athens (Greece) • + Baku (Azerbaijan) • + Balıkesir (Turkey) • + Barcelona (Spain) • + Barnaul (Russia) • + Belgrade (Serbia) • + Berlin (Germany) • + Birmingham (United Kingdom) • + Bratislava (Slovakia) • + Bremen (Germany) • + Brussels (Belgium) • + Bucharest (Romania) • + Budapest (Hungary) • + Bursa (Turkey) • + Chelyabinsk (Russia) • + Chișinău (Moldova) • + Cologne (Germany) • + Copenhagen (Denmark) • + Denizli (Turkey) • + Dnipro (Ukraine) • + Donetsk (Ukraine) • + Dortmund (Germany) • + Dresden (Germany) • + Dublin (Ireland) • + Düsseldorf (Germany) • + Essen (Germany) • + Frankfurt (Germany) • + Free Hanseatic City of Bremen (Germany) • + Ganja (Azerbaijan) • + Gaziantep (Turkey) • + Genoa (Italy) • + Glasgow (United Kingdom) • + Gomel (Belarus) • + Gothenburg (Sweden) • + Hamburg (Germany) • + Hanover (Germany) • + Helsinki (Finland) • + Istanbul (Turkey) • + Kayseri (Turkey) • + Kazan (Russia) • + Kemerovo (Russia) • + Khabarovsk (Russia) • + Kharkiv (Ukraine) • + Kraków (Poland) • + Krasnoyarsk (Russia) • + Kryvyi Rih (Ukraine) • + Kyiv (Ukraine) • + Leeds (United Kingdom) • + Leipzig (Germany) • + Lisbon (Portugal) • + London (United Kingdom) • + Lviv (Ukraine) • + Madrid (Spain) • + Makhachkala (Russia) • + Marseille (France) • + Milan (Italy) • + Minsk (Belarus) • + Moscow (Russia) • + Munich (Germany) • + Málaga (Spain) • + Naberezhnye Chelny (Russia) • + Naples (Italy) • + Nizhny Novgorod (Russia) • + Novosibirsk (Russia) • + Nuremberg (Germany) • + Omsk (Russia) • + Oslo (Norway) • + Palermo (Italy) • + Paris (France) • + Penza (Russia) • + Perm (Russia) • + Poznań (Poland) • + Prague (Czech Republic) • + Riga (Latvia) • + Rome (Italy) • + Rostov-on-Don (Russia) • + Rotterdam (Netherlands) • + Saint Petersburg (Russia) • + Samara (Russia) • + Seville (Spain) • + Sheffield (United Kingdom) • + Shymkent (Kazakhstan) • + Skopje (Republic of Macedonia) • + Sofia (Bulgaria) • + Stockholm (Sweden) • + Stuttgart (Germany) • + Tbilisi (Georgia) • + The Hague (Netherlands) • + Tolyatti (Russia) • + Turin (Italy) • + Tyumen (Russia) • + Ufa (Russia) • + Ulyanovsk (Russia) • + Valencia (Spain) • + Vienna (Austria) • + Vilnius (Lithuania) • + Vladivostok (Russia) • + Volgograd (Russia) • + Voronezh (Russia) • + Warsaw (Poland) • + Wrocław (Poland) • + Yaroslavl (Russia) • + Yekaterinburg (Russia) • + Yerevan (Armenia) • + Zagreb (Croatia) • + Zaporizhzhya (Ukraine) • + Zaragoza (Spain) • + İzmir (Turkey) • + Łódź (Poland) +
+
+

Africa

+ Abeokuta (Nigeria) • + Abidjan (Côte d'Ivoire) • + Abuja (Nigeria) • + Accra (Ghana) • + Addis Ababa (Ethiopia) • + Agadir (Morocco) • + Alexandria (Egypt) • + Algiers (Algeria) • + Antananarivo (Madagascar) • + Asmara (Eritrea) • + Bangui (Central African Republic) • + Benghazi (Libya) • + Blantyre (Malawi) • + Bouaké (Côte d'Ivoire) • + Brazzaville (Republic of the Congo) • + Bujumbura (Burundi) • + Bulawayo (Zimbabwe) • + Cairo (Egypt) • + Conakry (Guinea) • + Dar es Salaam (Tanzania) • + Djibouti (Djibouti) • + Douala (Cameroon) • + Fes (Morocco) • + Freetown (Sierra Leone) • + Giza (Egypt) • + Harare (Zimbabwe) • + Helwan (Egypt) • + Ife (Nigeria) • + Ilorin (Nigeria) • + Johannesburg (South Africa) • + Jos (Nigeria) • + Kaduna (Nigeria) • + Kampala (Uganda) • + Khartoum (Sudan) • + Khartoum North (Sudan) • + Kigali (Rwanda) • + Kinshasa (Democratic Republic of the Congo) • + Kitwe (Zambia) • + Kumasi (Ghana) • + Lagos (Nigeria) • + Libreville (Gabon) • + Lilongwe (Malawi) • + Lomé (Togo) • + Luanda (Angola) • + Lubumbashi (Democratic Republic of the Congo) • + Lusaka (Zambia) • + Maiduguri (Nigeria) • + Maputo (Mozambique) • + Marrakesh (Morocco) • + Matola (Mozambique) • + Mombasa (Kenya) • + Monrovia (Liberia) • + N'Djamena (Chad) • + Nairobi (Kenya) • + Niamey (Niger) • + Nouakchott (Mauritania) • + Ogbomosho (Nigeria) • + Omdurman (Sudan) • + Ouagadougou (Burkina Faso) • + Port Said (Egypt) • + Pretoria (South Africa) • + Rabat (Morocco) • + Sekondi-Takoradi (Ghana) • + Shubra El-Kheima (Egypt) • + Tripoli (Libya) • + Yaoundé (Cameroon) +
+
+

Asia

+ Abu Dhabi (United Arab Emirates) • + Adana (Turkey) • + Aden (Yemen) • + Agartala (India) • + Agra (India) • + Ahvaz (Iran) • + Al Ain (United Arab Emirates) • + Al Hudaydah (Yemen) • + Aleppo (Syria) • + Alexandria (Egypt) • + Almaty (Kazakhstan) • + Amman (Jordan) • + An Najaf (Iraq) • + Ankara (Turkey) • + Antalya (Turkey) • + Antipolo (Philippines) • + Astana (Kazakhstan) • + Astrakhan (Russia) • + Aurangabad (India) • + Bacolod (Philippines) • + Bacoor (Philippines) • + Baghdad (Iraq) • + Baku (Azerbaijan) • + Balikpapan (Indonesia) • + Balıkesir (Turkey) • + Bandarlampung (Indonesia) • + Bandung (Indonesia) • + Bangalore (India) • + Bangkok (Thailand) • + Banjarmasin (Indonesia) • + Bareilly (India) • + Barnaul (Russia) • + Batam (Indonesia) • + Beijing (People's Republic of China) • + Bekasi (Indonesia) • + Bhiwandi (India) • + Bishkek (Kyrgyzstan) • + Bogor (Indonesia) • + Bursa (Turkey) • + Busan (South Korea) • + Cagayan de Oro (Philippines) • + Cairo (Egypt) • + Caloocan (Philippines) • + Cebu City (Philippines) • + Chandigarh (India) • + Changde (People's Republic of China) • + Chelyabinsk (Russia) • + Chennai (India) • + Cheongju (South Korea) • + Chiba (Japan) • + Chongqing (People's Republic of China) • + Cimahi (Indonesia) • + Coimbatore (India) • + Colombo (Sri Lanka) • + Cần Thơ (Vietnam) • + Damascus (Syria) • + Daqing (People's Republic of China) • + Dasmariñas (Philippines) • + Davao City (Philippines) • + Delhi (India) • + Denizli (Turkey) • + Denpasar (Indonesia) • + Depok (Indonesia) • + Dhaka (Bangladesh) • + Doha (Qatar) • + Dubai (United Arab Emirates) • + Dushanbe (Tajikistan) • + Erbil (Iraq) • + Faisalabad (Pakistan) • + Fukuoka (Japan) • + Funabashi (Japan) • + Fuzhou (People's Republic of China) • + Ganja (Azerbaijan) • + Gaza City (Palestine) • + Gaziantep (Turkey) • + General Santos (Philippines) • + George Town (Malaysia) • + Giza (Egypt) • + Goyang (South Korea) • + Gujranwala (Pakistan) • + Guntur (India) • + Hachiōji City (Japan) • + Haiphong (Vietnam) • + Hamamatsu (Japan) • + Hamhung (North Korea) • + Hanoi (Vietnam) • + Hefei (People's Republic of China) • + Helwan (Egypt) • + Higashiōsaka (Japan) • + Himeji (Japan) • + Hiroshima (Japan) • + Ho Chi Minh City (Vietnam) • + Homs (Syria) • + Hyderabad (India) • + Hyderabad (Pakistan) • + Irbid (Jordan) • + Isfahan (Iran) • + Islamabad (Pakistan) • + Istanbul (Turkey) • + Jaipur (India) • + Jakarta (Indonesia) • + Jambi (Indonesia) • + Jeddah (Saudi Arabia) • + Jeonju (South Korea) • + Jerusalem (Israel) • + Jerusalem (Jordan) • + Jerusalem (Palestine) • + Jodhpur (India) • + Kabul (Afghanistan) • + Kagoshima (Japan) • + Kaifeng (People's Republic of China) • + Kaohsiung City (Taiwan) • + Karachi (Pakistan) • + Karaj (Iran) • + Kathmandu (Nepal) • + Kawaguchi (Japan) • + Kawasaki (Japan) • + Kayseri (Turkey) • + Kazan (Russia) • + Kemerovo (Russia) • + Kermanshah (Iran) • + Khabarovsk (Russia) • + Khulna (Bangladesh) • + Kirkuk (Iraq) • + Kitakyūshū (Japan) • + Klang (Malaysia) • + Kolkata (India) • + Krasnoyarsk (Russia) • + Kuala Lumpur (Malaysia) • + Kuantan (Malaysia) • + Kumamoto (Japan) • + Kuwait City (Kuwait) • + Kyoto (Japan) • + Kōbe (Japan) • + Lanzhou (People's Republic of China) • + Las Piñas (Philippines) • + Latakia (Syria) • + Macau (People's Republic of China) • + Makassar (Indonesia) • + Makati (Philippines) • + Makhachkala (Russia) • + Malang (Indonesia) • + Mandalay (Myanmar) • + Manila (Philippines) • + Matsuyama (Japan) • + Mawlamyine (Myanmar) • + Mecca (Saudi Arabia) • + Medan (Indonesia) • + Moscow (Russia) • + Mosul (Iraq) • + Mumbai (India) • + Muntinlupa (Philippines) • + Mysore (India) • + Naberezhnye Chelny (Russia) • + Nagoya (Japan) • + Nantong (People's Republic of China) • + Naypyidaw (Myanmar) • + Niigata (Japan) • + Nizhny Novgorod (Russia) • + Novosibirsk (Russia) • + Okayama (Japan) • + Omsk (Russia) • + Palembang (Indonesia) • + Parañaque (Philippines) • + Pasig (Philippines) • + Pekanbaru (Indonesia) • + Penza (Russia) • + Perm (Russia) • + Peshawar (Pakistan) • + Petaling Jaya (Malaysia) • + Phnom Penh (Cambodia) • + Pohang (South Korea) • + Pontianak (Indonesia) • + Port Said (Egypt) • + Pune (India) • + Pyongyang (North Korea) • + Qiqihar (People's Republic of China) • + Quetta (Pakistan) • + Quezon City (Philippines) • + Ranchi (India) • + Rawalpindi (Pakistan) • + Riyadh (Saudi Arabia) • + Rostov-on-Don (Russia) • + Sagamihara (Japan) • + Saint Petersburg (Russia) • + Saitama (Japan) • + Sakai City (Japan) • + Samara (Russia) • + Samarinda (Indonesia) • + Samarkand (Uzbekistan) • + San Jose del Monte (Philippines) • + Sana'a (Yemen) • + Sapporo (Japan) • + Sargodha (Pakistan) • + Semarang (Indonesia) • + Sendai (Japan) • + Seoul (South Korea) • + Serang (Indonesia) • + Shanghai (People's Republic of China) • + Shantou (People's Republic of China) • + Shaoxing (People's Republic of China) • + Shiraz (Iran) • + Shizuoka (Japan) • + Shubra El-Kheima (Egypt) • + Shymkent (Kazakhstan) • + Sialkot (Pakistan) • + Singapore (Singapore) • + Surabaya (Indonesia) • + Surakarta (Indonesia) • + Ta'izz (Yemen) • + Taguig (Philippines) • + Taipei (Taiwan) • + Tangerang (Indonesia) • + Tangerang Selatan (Indonesia) • + Taoyuan District (Taiwan) • + Tashkent (Uzbekistan) • + Tasikmalaya (Indonesia) • + Tehran (Iran) • + Tianjin (People's Republic of China) • + Tokyo (Japan) • + Tokyo (Japan) • + Tolyatti (Russia) • + Trichy (India) • + Trichy (Tamil Nadu) • + Tyumen (Russia) • + Ufa (Russia) • + Ulaanbaatar (Mongolia) • + Ulsan (South Korea) • + Ulyanovsk (Russia) • + Utsunomiya (Japan) • + Valenzuela (Philippines) • + Varanasi (India) • + Vientiane (Laos) • + Vijayawada (India) • + Visakhapatnam (India) • + Vladivostok (Russia) • + Volgograd (Russia) • + Voronezh (Russia) • + Wenzhou (People's Republic of China) • + Wuhu (People's Republic of China) • + Yancheng (People's Republic of China) • + Yangon (Myanmar) • + Yaroslavl (Russia) • + Yazd (Iran) • + Yekaterinburg (Russia) • + Yokohama (Japan) • + Yongin (South Korea) • + Zamboanga City (Philippines) • + Zhengzhou (People's Republic of China) • + Zibo (People's Republic of China) • + İzmir (Turkey) • + Ōsaka (Japan) +
+
+

Central America

+ Emilce nombre unico (Guatemala) • + Guatemala City (Guatemala) • + Havana (Cuba) • + Santiago de Cuba (Cuba) +
+
+

North America

+ Acapulco (Mexico) • + Albuquerque (United States of America) • + Austin (United States of America) • + Baltimore (United States of America) • + Boston (United States of America) • + Calgary (Canada) • + Carrefour (Haiti) • + Chicago (United States of America) • + Chihuahua (Mexico) • + Ciudad Nezahualcóyotl (Mexico) • + Columbus (United States of America) • + Culiacán (Mexico) • + Dallas (United States of America) • + Denver (United States of America) • + Detroit (United States of America) • + Ecatepec de Morelos (Mexico) • + Edmonton (Canada) • + El Paso (United States of America) • + Ensenada (Mexico) • + Fort Worth (United States of America) • + Hamilton (Canada) • + Hermosillo (Mexico) • + Houston (United States of America) • + Indianapolis (United States of America) • + Jacksonville (United States of America) • + Kingston (Jamaica) • + Las Vegas (United States of America) • + León (Mexico) • + Los Angeles (United States of America) • + Louisville (United States of America) • + Managua (Nicaragua) • + Memphis (United States of America) • + Mexico City (Mexico) • + Milwaukee (United States of America) • + Mississauga (Canada) • + Monterrey (Mexico) • + Montreal (Canada) • + Nashville (United States of America) • + New York City (United States of America) • + Oklahoma City (United States of America) • + Ottawa (Canada) • + Panama City (Panama) • + Philadelphia (United States of America) • + Phoenix (United States of America) • + Port-au-Prince (Haiti) • + Portland (United States of America) • + Quebec City (Canada) • + San Antonio (United States of America) • + San Diego (United States of America) • + San Francisco (United States of America) • + San Jose (United States of America) • + San Pedro Sula (Honduras) • + San Salvador (El Salvador) • + Santiago de los Caballeros (Dominican Republic) • + Santo Domingo (Dominican Republic) • + Seattle (United States of America) • + Tegucigalpa (Honduras) • + Tlaquepaque (Mexico) • + Toronto (Canada) • + Tucson (United States of America) • + Tultitlán de Mariano Escobedo (Mexico) • + Tuxtla Gutiérrez (Mexico) • + Vancouver (Canada) • + Washington, D.C. (United States of America) • + Winnipeg (Canada) • + Xalapa (Mexico) • + Zapopan (Mexico) +
+
+

Oceania

+ Adelaide (Australia) • + Albuquerque (United States of America) • + Auckland (New Zealand) • + Austin (United States of America) • + Baltimore (United States of America) • + Boston (United States of America) • + Brisbane (Australia) • + Chicago (United States of America) • + Columbus (United States of America) • + Dallas (United States of America) • + Denver (United States of America) • + Detroit (United States of America) • + El Paso (United States of America) • + Fort Worth (United States of America) • + Houston (United States of America) • + Indianapolis (United States of America) • + Jacksonville (United States of America) • + Las Vegas (United States of America) • + Los Angeles (United States of America) • + Louisville (United States of America) • + Melbourne (Australia) • + Memphis (United States of America) • + Milwaukee (United States of America) • + Nashville (United States of America) • + New York City (United States of America) • + Oklahoma City (United States of America) • + Perth (Australia) • + Philadelphia (United States of America) • + Phoenix (United States of America) • + Portland (United States of America) • + San Antonio (United States of America) • + San Diego (United States of America) • + San Francisco (United States of America) • + San Jose (United States of America) • + Seattle (United States of America) • + Sydney (Australia) • + Tucson (United States of America) • + Washington, D.C. (United States of America) +
+
+

South America

+ Arequipa (Peru) • + Asunción (Paraguay) • + Barquisimeto (Venezuela) • + Belo Horizonte (Brazil) • + Belém (Brazil) • + Bogota (Colombia) • + Brasília (Brazil) • + Buenos Aires (Argentina) • + Cali (Colombia) • + Callao (Peru) • + Campinas (Brazil) • + Chiclayo (Peru) • + Curitiba (Brazil) • + Cúcuta (Venezuela) • + Fortaleza (Brazil) • + Goiânia (Brazil) • + Guarulhos (Brazil) • + Guayaquil (Ecuador) • + La Paz (Bolivia) • + La Plata (Argentina) • + Lima (Peru) • + Maceió (Brazil) • + Manaus (Brazil) • + Mar del Plata (Argentina) • + Maracay (Venezuela) • + Montevideo (Uruguay) • + Osasco (Brazil) • + Panama City (Panama) • + Porto Alegre (Brazil) • + Quito (Ecuador) • + Recife (Brazil) • + Ribeirão Preto (Brazil) • + Rio de Janeiro (Brazil) • + Rosario (Argentina) • + San Miguel de Tucumán (Argentina) • + Santa Cruz (Bolivia) • + Santiago (Chile) • + Santo André (Brazil) • + Sorocaba (Brazil) • + São Bernardo do Campo (Brazil) • + São José dos Campos (Brazil) • + São Luís (Brazil) • + São Paulo (Brazil) • + Trujillo (Peru) • + Uberlândia (Brazil) • + Yurimaguas (Peru) +
+
+
+
+

Language

+
+ + + + + + + + + + + + +
+ Save +
+ +
+
\ No newline at end of file diff --git a/src/components/main/dashboard/dashboard.js b/src/components/main/dashboard/dashboard.js index c947367..a891226 100755 --- a/src/components/main/dashboard/dashboard.js +++ b/src/components/main/dashboard/dashboard.js @@ -24,7 +24,9 @@ function controller($state, $window, WikiService, localStorageService) { } function saveLanguages() { - vm.languages.indexOf('en') === -1 ? vm.languages.push('en') : false; + if (vm.languages.includes('en')) { + vm.languages.push('en'); + } localStorageService.set('languages', vm.languages.filter(lang => lang)); $state.reload(); } diff --git a/src/components/main/dashboard/dashboard.scss b/src/components/main/dashboard/dashboard.scss index 19a3ea0..602dda5 100755 --- a/src/components/main/dashboard/dashboard.scss +++ b/src/components/main/dashboard/dashboard.scss @@ -1,9 +1,9 @@ -@import '../../../styles/variables'; -@import '../../../styles/responsive'; - -mo-dashboard { - .dashboard { - width: 980px; - max-width: 100%; - } +@import '../../../styles/variables'; +@import '../../../styles/responsive'; + +mo-dashboard { + .dashboard { + width: 980px; + max-width: 100%; + } } \ No newline at end of file diff --git a/src/components/main/list/list.html b/src/components/main/list/list.html index 0da5a57..a5dfff4 100755 --- a/src/components/main/list/list.html +++ b/src/components/main/list/list.html @@ -1,69 +1,69 @@ - -
- - Dashboard - - - - - {{item.label}} - {{item.description}} - - -
-
-
- -
- - - {{$ctrl.list.length}} results - Loading... - - -
- {{item.name.value}} -
-
-

{{item.name.value}}

-

{{item.admin.value}}

-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
-
- -
-
+ +
+ + Dashboard + + + + + {{item.label}} + {{item.description}} + + +
+
+
+ +
+ + + {{$ctrl.list.length}} results + Loading... + + +
+ {{item.name.value}} +
+
+

{{item.name.value}}

+

{{item.admin.value}}

+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+
+
+ +
+
\ No newline at end of file diff --git a/src/components/main/list/list.js b/src/components/main/list/list.js index 0ce8fcb..aa77f17 100755 --- a/src/components/main/list/list.js +++ b/src/components/main/list/list.js @@ -1,140 +1,135 @@ -import _ from 'lodash'; - -import './list.scss'; -import template from './list.html'; -import '../../../images/marker.png'; - -const ListComponent = { - controller: controller, - template: template -}; - -function controller($state, $stateParams, $timeout, leafletData, localStorageService, wikidata) { - let vm = this; - const id = $stateParams.id[0] === 'Q' ? $stateParams.id : 'Q' + $stateParams.id; - - vm.map = {}; - vm.listParams = {}; - - vm.goToItem = (item) => item ? $state.go('main.list', { id: item.id.substring(1) }) : false; - vm.querySearch = (text) => wikidata.getSearch(text); - vm.search = {}; - - const icon = { - iconUrl: 'assets/images/marker.png', - shadowUrl: undefined, - iconSize: [40, 40], - shadowSize: [0, 0], - iconAnchor: [20, 20], - shadowAnchor: [0, 0] - }; - - vm.map = { - center: { - lat: 51.686, - lng: 19.545, - zoom: 7 - }, - markers: {}, - layers: { - baselayers: { - osm: { - name: 'OpenStreetMap', - type: 'xyz', - url: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', - layerOptions: { - subdomains: ['a', 'b', 'c'], - attribution: '© OpenStreetMap contributors', - continuousWorld: true - } - } - }, - overlays: { - monuments: { - name: 'Monuments', - type: 'markercluster', - visible: true - } - } - } - }; - - if (!id || id === 'Q') { - vm.showMap = true; - return; - } - - let langs = $stateParams.lang ? [$stateParams.lang] : []; - langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); - wikidata.setLanguages(langs); - - wikidata.getSearch(id).then(results => { - vm.search.selectedItem = results.length ? results[0] : undefined; - }); - - wikidata.getSPARQL(`SELECT DISTINCT ?item ?itemLabel (SAMPLE(?admin) AS ?admin) (SAMPLE(?adminLabel) AS ?adminLabel) (SAMPLE(?coord) AS ?coord) (SAMPLE(?image) AS ?image) - WHERE { - ?item p:P1435 ?monument . - ?item wdt:P131* wd:` + id + ` . - ?item wdt:P131 ?admin . - ?item wdt:P625 ?coord . - OPTIONAL { ?item wdt:P18 ?image } - OPTIONAL { ?admin rdfs:label ?adminLabel. FILTER(LANG(?adminLabel) = "` + langs[0] + `"). } - SERVICE wikibase:label { bd:serviceParam wikibase:language "` + langs.join(',') + `" } - } - GROUP BY ?item ?itemLabel - ORDER BY ?itemLabel`).then(data => { - // console.log(data) - vm.list = data.map(element => ({ - name: { - value_id: element.item.value.substring(element.item.value.indexOf('/Q') + 1), - value: element.itemLabel.value - }, - admin: { - value_id: element.admin.value.substring(element.admin.value.indexOf('/Q') + 1), - value: element.adminLabel ? element.adminLabel.value : element.admin.value.substring(element.admin.value.indexOf('/Q') + 1) - }, - coord: element.coord.value ? element.coord.value.replace('Point(', '').replace(')', '').split(' ') : false, - image: element.image ? element.image.value.replace('wiki/Special:FilePath', 'w/index.php?title=Special:Redirect/file') + '&width=120' : false - })); - return vm.list; - }).then(list => { - let bounds = []; - list.forEach(element => { - if (element.coord) { - vm.map.markers[element.name.value_id] = { - lat: +element.coord[1], - lng: +element.coord[0], - message: ` - -
- ${element.name.value} -
-
-

${element.name.value}

-

${element.admin.value}

-
-
`, - layer: 'monuments', - icon: icon - }; - bounds.push([+element.coord[1], +element.coord[0]]); - } - }); - $timeout(() => { - vm.showMap = true; - leafletData.getMap().then(function (map) { - if (bounds.length) { - map.fitBounds(bounds, { padding: [25, 25] }); - } - }); - }); - }); -} - -export default () => { - angular - .module('monumental') - .component('moList', ListComponent); -}; +import './list.scss'; +import template from './list.html'; +import '../../../images/marker.png'; + +const ListComponent = { controller, template }; + +function controller($state, $stateParams, $timeout, leafletData, localStorageService, wikidata) { + const vm = this; + const id = $stateParams.id[0] === 'Q' ? $stateParams.id : 'Q' + $stateParams.id; + + vm.map = {}; + vm.listParams = {}; + + vm.goToItem = item => item ? $state.go('main.list', { id: item.id.substring(1) }) : false; + vm.querySearch = text => wikidata.getSearch(text); + vm.search = {}; + + const icon = { + iconUrl: 'assets/images/marker.png', + shadowUrl: undefined, + iconSize: [40, 40], + shadowSize: [0, 0], + iconAnchor: [20, 20], + shadowAnchor: [0, 0], + }; + + vm.map = { + center: { + lat: 51.686, + lng: 19.545, + zoom: 7, + }, + markers: {}, + layers: { + baselayers: { + osm: { + name: 'OpenStreetMap', + type: 'xyz', + url: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + layerOptions: { + subdomains: ['a', 'b', 'c'], + attribution: '© OpenStreetMap contributors', + continuousWorld: true, + }, + }, + }, + overlays: { + monuments: { + name: 'Monuments', + type: 'markercluster', + visible: true, + }, + }, + }, + }; + + if (!id || id === 'Q') { + vm.showMap = true; + return; + } + + let langs = $stateParams.lang ? [$stateParams.lang] : []; + langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); + wikidata.setLanguages(langs); + + wikidata.getSearch(id).then((results) => { + vm.search.selectedItem = results.length ? results[0] : undefined; + }); + + wikidata.getSPARQL(`SELECT DISTINCT ?item ?itemLabel (SAMPLE(?admin) AS ?admin) (SAMPLE(?adminLabel) AS ?adminLabel) (SAMPLE(?coord) AS ?coord) (SAMPLE(?image) AS ?image) + WHERE { + ?item p:P1435 ?monument . + ?item wdt:P131* wd:${id} . + ?item wdt:P131 ?admin . + ?item wdt:P625 ?coord . + OPTIONAL { ?item wdt:P18 ?image } + OPTIONAL { ?admin rdfs:label ?adminLabel. FILTER(LANG(?adminLabel) = "${langs[0]}"). } + SERVICE wikibase:label { bd:serviceParam wikibase:language "${langs.join(',')}" } + } + GROUP BY ?item ?itemLabel + ORDER BY ?itemLabel`).then((data) => { + // console.log(data) + vm.list = data.map(element => ({ + name: { + value_id: element.item.value.substring(element.item.value.indexOf('/Q') + 1), + value: element.itemLabel.value, + }, + admin: { + value_id: element.admin.value.substring(element.admin.value.indexOf('/Q') + 1), + value: element.adminLabel ? element.adminLabel.value : element.admin.value.substring(element.admin.value.indexOf('/Q') + 1), + }, + coord: element.coord.value ? element.coord.value.replace('Point(', '').replace(')', '').split(' ') : false, + image: element.image ? element.image.value.replace('wiki/Special:FilePath', 'w/index.php?title=Special:Redirect/file') + '&width=120' : false + })); + return vm.list; + }).then((list) => { + const bounds = []; + list.forEach((element) => { + if (element.coord) { + vm.map.markers[element.name.value_id] = { + lat: +element.coord[1], + lng: +element.coord[0], + message: ` + +
+ ${element.name.value} +
+
+

${element.name.value}

+

${element.admin.value}

+
+
`, + layer: 'monuments', + icon, + }; + bounds.push([+element.coord[1], +element.coord[0]]); + } + }); + $timeout(() => { + vm.showMap = true; + leafletData.getMap().then(function (map) { + if (bounds.length) { + map.fitBounds(bounds, { padding: [25, 25] }); + } + }); + }); + }); +} + +export default () => { + angular + .module('monumental') + .component('moList', ListComponent); +}; diff --git a/src/components/main/list/list.scss b/src/components/main/list/list.scss index 8652e76..35a28ff 100755 --- a/src/components/main/list/list.scss +++ b/src/components/main/list/list.scss @@ -1,58 +1,58 @@ -@import '../../../styles/variables'; -@import '../../../styles/responsive'; - -mo-list { - .list { - width: 450px; - height: calc(100vh - 105px); - } - - .list__container { - margin-right: 20px; - - md-list-item.md-2-line { - border-bottom: 1px solid $softGrey; - } - } - - .list__image { - width: 75px; - min-width: 75px; - height: 75px; - background: $softGrey; - margin: 15px 15px 15px 0; - - img { - max-width: 100%; - max-height: 100%; - } - } - - .list__map { - background: $softGrey; - - .angular-leaflet-map { - width: 100%; - height: 100%; - } - - .leaflet-popup-close-button { - z-index: 1; - padding: 5px; - } - - .leaflet-popup-content-wrapper { - border-radius: 2px; - } - - .leaflet-popup-content { - min-width: 300px; - margin: 0; - font: 16px Roboto, Arial, sans-serif; - } - } - - md-autocomplete { - margin: 20px; - } +@import '../../../styles/variables'; +@import '../../../styles/responsive'; + +mo-list { + .list { + width: 450px; + height: calc(100vh - 105px); + } + + .list__container { + margin-right: 20px; + + md-list-item.md-2-line { + border-bottom: 1px solid $softGrey; + } + } + + .list__image { + width: 75px; + min-width: 75px; + height: 75px; + background: $softGrey; + margin: 15px 15px 15px 0; + + img { + max-width: 100%; + max-height: 100%; + } + } + + .list__map { + background: $softGrey; + + .angular-leaflet-map { + width: 100%; + height: 100%; + } + + .leaflet-popup-close-button { + z-index: 1; + padding: 5px; + } + + .leaflet-popup-content-wrapper { + border-radius: 2px; + } + + .leaflet-popup-content { + min-width: 300px; + margin: 0; + font: 16px Roboto, Arial, sans-serif; + } + } + + md-autocomplete { + margin: 20px; + } } \ No newline at end of file diff --git a/src/components/main/main.js b/src/components/main/main.js index 976b767..efc6a08 100755 --- a/src/components/main/main.js +++ b/src/components/main/main.js @@ -1,28 +1,25 @@ -import './main.scss'; -import template from './main.html'; -import pack from '../../../package.json'; - -const MainComponent = { - controller: controller, - template: template -}; - -function controller(wikidata, $state, $stateParams, localStorageService) { - let vm = this; - - let langs = $stateParams.lang ? [$stateParams.lang] : []; - langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); - - vm.lang = langs[0]; - wikidata.setLanguages(langs); - - vm.goToItem = (item) => $state.go('main.object', {id: item.title.substring(1)}); - vm.querySearch = (text) => wikidata.getSearch(text); - vm.search = {}; -} - -export default () => { - angular - .module('monumental') - .component('moMain', MainComponent); -}; +import './main.scss'; +import template from './main.html'; +import pack from '../../../package.json'; + +const MainComponent = { controller, template }; + +function controller(wikidata, $state, $stateParams, localStorageService) { + const vm = this; + + let langs = $stateParams.lang ? [$stateParams.lang] : []; + langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); + + vm.lang = langs[0]; + wikidata.setLanguages(langs); + + vm.goToItem = item => $state.go('main.object', { id: item.title.substring(1) }); + vm.querySearch = text => wikidata.getSearch(text); + vm.search = {}; +} + +export default () => { + angular + .module('monumental') + .component('moMain', MainComponent); +}; diff --git a/src/components/main/main.scss b/src/components/main/main.scss index 09284f7..f30b3f8 100755 --- a/src/components/main/main.scss +++ b/src/components/main/main.scss @@ -1,18 +1,18 @@ -@import '../../styles/variables'; -@import '../../styles/responsive'; - -.toolbar { - .md-toolbar-tools { - max-width: 980px; - padding: 0; - - md-autocomplete { - width: 300px; - } - } - - &.toolbar--wide .md-toolbar-tools { - max-width: 100%; - padding-left: 15px; - } +@import '../../styles/variables'; +@import '../../styles/responsive'; + +.toolbar { + .md-toolbar-tools { + max-width: 980px; + padding: 0; + + md-autocomplete { + width: 300px; + } + } + + &.toolbar--wide .md-toolbar-tools { + max-width: 100%; + padding-left: 15px; + } } \ No newline at end of file diff --git a/src/components/main/map/map.html b/src/components/main/map/map.html index 0080b17..1d73374 100755 --- a/src/components/main/map/map.html +++ b/src/components/main/map/map.html @@ -1,61 +1,61 @@ - -
- - Dashboard - - - - - {{item.label}} - {{item.description}} - - -
-
-
- -
-
-

Zoom in

-
-
- -
-
-

No results

-
- - -
- {{item.name.value}} -
-
-

{{item.name.value}}

-

{{item.admin.value}}

-
-
-
-
-
- -
-
+ +
+ + Dashboard + + + + + {{item.label}} + {{item.description}} + + +
+
+
+ +
+
+

Zoom in

+
+
+ +
+
+

No results

+
+ + +
+ {{item.name.value}} +
+
+

{{item.name.value}}

+

{{item.admin.value}}

+
+
+
+
+
+ +
+
\ No newline at end of file diff --git a/src/components/main/map/map.js b/src/components/main/map/map.js index 828b019..6b758a5 100755 --- a/src/components/main/map/map.js +++ b/src/components/main/map/map.js @@ -1,141 +1,145 @@ -import './map.scss'; -import template from './map.html'; - -const MapComponent = { controller, template }; - -function controller($location, $scope, $state, $stateParams, $timeout, leafletData, localStorageService, mapService, wikidata) { - const vm = this; - const icon = mapService.getMapIcon(); - - // bindings - - vm.goToItem = item => setMap(item); - vm.map = mapService.getMapInstance({ center: { lat: 49.4967, lng: 12.4805, zoom: 4 } }); - vm.querySearch = text => wikidata.getSearch(text); - vm.list = []; - vm.listParams = {}; - vm.loading = false; - vm.loadingMap = true; - vm.search = {}; - - // activate - - let langs = $stateParams.lang ? [$stateParams.lang] : []; - langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); - wikidata.setLanguages(langs); - - $scope.$on('centerUrlHash', (event, centerHash) => { - $location.search({ c: centerHash }); - }); - - $timeout(() => { - vm.loadingMap = false; - leafletData.getMap().then((map) => { - if (map.getZoom() > 12) { - getDataBB(map.getBounds()); - } - map.on('dragend zoomend', () => { - if (map.getZoom() > 12) { - getDataBB(map.getBounds()); - } - }); - }); - }, 100); - - // functions - - function getDataBB(bounds) { - vm.loading = true; - wikidata.getSPARQL(`SELECT ?item ?itemLabel ?admin ?adminLabel ?image ?coord ?heritage WHERE { - SERVICE wikibase:box { - ?item wdt:P625 ?coord . - bd:serviceParam wikibase:cornerWest "Point(${bounds.getSouthWest().lng} ${bounds.getSouthWest().lat})"^^geo:wktLiteral . - bd:serviceParam wikibase:cornerEast "Point(${bounds.getNorthEast().lng} ${bounds.getNorthEast().lat})"^^geo:wktLiteral . - } - OPTIONAL { ?item wdt:P131 ?admin . } - OPTIONAL { ?item wdt:P18 ?image . } - ?item wdt:P1435 ?heritage . - SERVICE wikibase:label { bd:serviceParam wikibase:language "${langs.join(',')}" } - }`).then((data) => { - vm.map.markers = {}; - vm.list = data.map(element => setListElement(element)); - vm.list.forEach((element) => { - vm.map.markers[element.name.value_id] = setMarker(element); - }); - vm.loading = false; - }); - } - - function getImage(image) { - if (image) { - const newImage = image.value.replace('wiki/Special:FilePath', 'w/index.php?title=Special:Redirect/file'); - return `${newImage}&width=120`; - } - return false; - } - - function getMessage(element) { - return ` -
- ${element.name.value} -
-
-

${element.name.value}

-

${element.admin ? element.admin.value : ''}

-
-
`; - } - - function setListElement(element) { - const id = element.item.value; - const obj = { - name: { - value_id: id.substring(id.indexOf('/Q') + 1), - value: element.itemLabel.value, - }, - coord: element.coord.value ? element.coord.value.replace('Point(', '').replace(')', '').split(' ') : false, - image: getImage(element.image), - }; - if (element.admin) { - obj.admin = { - value_id: element.admin.value.substring(element.admin.value.indexOf('/Q') + 1), - value: element.adminLabel ? element.adminLabel.value : element.admin.value.substring(element.admin.value.indexOf('/Q') + 1), - }; - } - return obj; - } - - function setMap(item) { - if (!item || !item.id) { return; } - vm.loading = true; - wikidata.getById(item.id) - .then((data) => { - const element = Object.values(data)[0]; - const coords = element.claims.P625; - if (coords) { - const lat = coords.values[0].value.latitude; - const lng = coords.values[0].value.longitude; - leafletData.getMap().then((map) => { - map.setView([lat, lng], 14); - getDataBB(map.getBounds()); - }); - } - }); - } - - function setMarker(element) { - return { - lat: +element.coord[1], - lng: +element.coord[0], - message: getMessage(element), - layer: 'monuments', - icon, - }; - } -} - -export default () => { - angular - .module('monumental') - .component('moMap', MapComponent); -}; +import './map.scss'; +import template from './map.html'; + +const MapComponent = { controller, template }; + +function controller($location, $scope, $state, $stateParams, $timeout, leafletData, localStorageService, mapService, wikidata) { + const vm = this; + const icon = mapService.getMapIcon(); + + // bindings + + vm.goToItem = item => setMap(item); + vm.map = mapService.getMapInstance({ center: { lat: 49.4967, lng: 12.4805, zoom: 4 } }); + vm.querySearch = text => wikidata.getSearch(text); + vm.list = []; + vm.listParams = {}; + vm.loading = false; + vm.loadingMap = true; + vm.search = {}; + + // activate + + let langs = $stateParams.lang ? [$stateParams.lang] : []; + langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); + wikidata.setLanguages(langs); + + $scope.$on('centerUrlHash', (event, centerHash) => { + $location.search({ c: centerHash }); + }); + + $timeout(() => { + vm.loadingMap = false; + leafletData.getMap().then((map) => { + if (map.getZoom() > 12) { + getDataBB(map.getBounds()); + } + map.on('dragend zoomend', () => { + if (map.getZoom() > 12) { + getDataBB(map.getBounds()); + } + }); + }); + }, 100); + + // functions + + function getDataBB(bounds) { + vm.loading = true; + wikidata.getSPARQL(`SELECT ?item ?itemLabel ?admin ?adminLabel ?image ?coord ?heritage WHERE { + SERVICE wikibase:box { + ?item wdt:P625 ?coord . + bd:serviceParam wikibase:cornerWest "Point(${bounds.getSouthWest().lng} ${bounds.getSouthWest().lat})"^^geo:wktLiteral . + bd:serviceParam wikibase:cornerEast "Point(${bounds.getNorthEast().lng} ${bounds.getNorthEast().lat})"^^geo:wktLiteral . + } + OPTIONAL { ?item wdt:P131 ?admin . } + OPTIONAL { ?item wdt:P18 ?image . } + ?item wdt:P1435 ?heritage . + SERVICE wikibase:label { bd:serviceParam wikibase:language "${langs.join(',')}" } + }`).then((data) => { + vm.map.markers = {}; + vm.list = data.map(element => setListElement(element)); + vm.list.forEach((element) => { + vm.map.markers[element.name.value_id] = setMarker(element); + }); + vm.loading = false; + }); + } + + /** + * Gets link to image + * @param {String} image + */ + function getImage(image) { + if (image) { + const newImage = image.value.replace('wiki/Special:FilePath', 'w/index.php?title=Special:Redirect/file'); + return `${newImage}&width=120`; + } + return false; + } + + function getMessage(element) { + return ` +
+ ${element.name.value} +
+
+

${element.name.value}

+

${element.admin ? element.admin.value : ''}

+
+
`; + } + + function setListElement(element) { + const id = element.item.value; + const obj = { + name: { + value_id: id.substring(id.indexOf('/Q') + 1), + value: element.itemLabel.value, + }, + coord: element.coord.value ? element.coord.value.replace('Point(', '').replace(')', '').split(' ') : false, + image: getImage(element.image), + }; + if (element.admin) { + obj.admin = { + value_id: element.admin.value.substring(element.admin.value.indexOf('/Q') + 1), + value: element.adminLabel ? element.adminLabel.value : element.admin.value.substring(element.admin.value.indexOf('/Q') + 1), + }; + } + return obj; + } + + function setMap(item) { + if (!item || !item.id) { return; } + vm.loading = true; + wikidata.getById(item.id) + .then((data) => { + const element = Object.values(data)[0]; + const coords = element.claims.P625; + if (coords) { + const lat = coords.values[0].value.latitude; + const lng = coords.values[0].value.longitude; + leafletData.getMap().then((map) => { + map.setView([lat, lng], 14); + getDataBB(map.getBounds()); + }); + } + }); + } + + function setMarker(element) { + return { + lat: +element.coord[1], + lng: +element.coord[0], + message: getMessage(element), + layer: 'monuments', + icon, + }; + } +} + +export default () => { + angular + .module('monumental') + .component('moMap', MapComponent); +}; diff --git a/src/components/main/map/map.scss b/src/components/main/map/map.scss index 59be907..18ed654 100755 --- a/src/components/main/map/map.scss +++ b/src/components/main/map/map.scss @@ -1,87 +1,87 @@ -@import '../../../styles/variables'; -@import '../../../styles/responsive'; - -mo-map { - .list { - position: relative; - width: 450px; - height: calc(100vh - 105px); - } - - .list__container { - margin-right: 20px; - - md-list-item.md-2-line { - border-bottom: 1px solid $softGrey; - } - } - - .list__loading { - position: absolute; - z-index: 10; - width: 100%; - height: 100%; - background: rgba(250,250,250,.8); - padding: 20px; - - md-progress-linear { - max-width: 200px; - } - - &.ng-enter { - transition: 0.3s linear all; - opacity: 0; - } - &.ng-enter.ng-enter-active { - opacity: 1; - } - &.ng-leave { - transition: 0.3s linear all; - opacity: 1; - } - &.ng-leave.ng-leave-active { - opacity: 0; - } - } - - .list__image { - width: 75px; - min-width: 75px; - height: 75px; - background: $softGrey; - margin: 15px 15px 15px 0; - - img { - max-width: 100%; - max-height: 100%; - } - } - - .list__map { - background: $softGrey; - - .angular-leaflet-map { - width: 100%; - height: 100%; - } - - .leaflet-popup-close-button { - z-index: 1; - padding: 5px; - } - - .leaflet-popup-content-wrapper { - border-radius: 2px; - } - - .leaflet-popup-content { - min-width: 300px; - margin: 0; - font: 16px Roboto, Arial, sans-serif; - } - } - - md-autocomplete { - margin: 20px; - } +@import '../../../styles/variables'; +@import '../../../styles/responsive'; + +mo-map { + .list { + position: relative; + width: 450px; + height: calc(100vh - 105px); + } + + .list__container { + margin-right: 20px; + + md-list-item.md-2-line { + border-bottom: 1px solid $softGrey; + } + } + + .list__loading { + position: absolute; + z-index: 10; + width: 100%; + height: 100%; + background: rgba(250,250,250,.8); + padding: 20px; + + md-progress-linear { + max-width: 200px; + } + + &.ng-enter { + transition: 0.3s linear all; + opacity: 0; + } + &.ng-enter.ng-enter-active { + opacity: 1; + } + &.ng-leave { + transition: 0.3s linear all; + opacity: 1; + } + &.ng-leave.ng-leave-active { + opacity: 0; + } + } + + .list__image { + width: 75px; + min-width: 75px; + height: 75px; + background: $softGrey; + margin: 15px 15px 15px 0; + + img { + max-width: 100%; + max-height: 100%; + } + } + + .list__map { + background: $softGrey; + + .angular-leaflet-map { + width: 100%; + height: 100%; + } + + .leaflet-popup-close-button { + z-index: 1; + padding: 5px; + } + + .leaflet-popup-content-wrapper { + border-radius: 2px; + } + + .leaflet-popup-content { + min-width: 300px; + margin: 0; + font: 16px Roboto, Arial, sans-serif; + } + } + + md-autocomplete { + margin: 20px; + } } \ No newline at end of file diff --git a/src/components/main/monument/monument.html b/src/components/main/monument/monument.html index 2fbf62b..b253080 100755 --- a/src/components/main/monument/monument.html +++ b/src/components/main/monument/monument.html @@ -1,200 +1,200 @@ - -
- - Dashboard - - - -
-
-
-
-
-
-
- - - -
-
-
-
-

{{$ctrl.monument.labels[$ctrl.lang] || 'no name'}}

-

{{$ctrl.monument.labels.en || 'no english name'}}

-
-
- Upload -
-
-
-
- place - - - {{place.value}} · - - no location - -
-
-
- photo - {{$ctrl.images.length || 0}} images -
-
- description - {{$ctrl.monument.interwikis || 0}} wikis -
-
- -
-
-
-
- -
-
-
-

Wikipedia

- - - {{wiki}} - -
-
- - Show more - -
- -
-
-

Properties

-
- {{claim.property[$ctrl.lang]}} - - - {{value.value}} - {{value.value}} - {{value.value.latitude}} / {{value.value.longitude}} - {{value.value.amount}} - {{value.value}} - {{value.value.time.substring(1) | date : 'yyyy'}} - {{value.value}} - {{value.value[$ctrl.lang] || value.value.en}} - - -
-
-
-
- - -
-
+ +
+ + Dashboard + + + +
+
+
+
+
+
+
+ + + +
+
+
+
+

{{$ctrl.monument.labels[$ctrl.lang] || 'no name'}}

+

{{$ctrl.monument.labels.en || 'no english name'}}

+
+
+ Upload +
+
+
+
+ place + + + {{place.value}} · + + no location + +
+
+
+ photo + {{$ctrl.images.length || 0}} images +
+
+ description + {{$ctrl.monument.interwikis || 0}} wikis +
+
+ +
+
+
+
+ +
+
+
+

Wikipedia

+ + + {{wiki}} + +
+
+ + Show more + +
+ +
+
+

Properties

+
+ {{claim.property[$ctrl.lang]}} + + + {{value.value}} + {{value.value}} + {{value.value.latitude}} / {{value.value.longitude}} + {{value.value.amount}} + {{value.value}} + {{value.value.time.substring(1) | date : 'yyyy'}} + {{value.value}} + {{value.value[$ctrl.lang] || value.value.en}} + + +
+
+
+
+ + +
+
diff --git a/src/components/main/monument/monument.js b/src/components/main/monument/monument.js index 8d15165..cd70279 100755 --- a/src/components/main/monument/monument.js +++ b/src/components/main/monument/monument.js @@ -14,7 +14,7 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora vm.image = []; vm.map = {}; - vm.addCategory = function() { + vm.addCategory = function () { WikiService.setClaim({ action: 'wbcreateclaim', format: 'json', @@ -38,8 +38,8 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora function getCategoryMembers(category) { WikiService.getCategoryMembers(category).then((data) => { const promises = data.map(image => WikiService.getImage(image, { iiurlheight: 75 })); - $q.all(promises).then((data) => { - vm.images = data.map(image => image.imageinfo); + $q.all(promises).then((response) => { + vm.images = response.map(image => image.imageinfo); }); }); } @@ -57,18 +57,18 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora function getCommonsLink() { const name = vm.monument.claims.P373.values[0].value; - return 'https://commons.wikimedia.org/wiki/Category:' + encodeURIComponent(name); + return `https://commons.wikimedia.org/wiki/Category:${encodeURIComponent(name)}`; } function getFullLocation(id) { - wikidata.getRecursive(id, 'P131').then(data => { - vm.location = data; + wikidata.getRecursive(id, 'P131').then((response) => { + vm.location = response; }); } function getImage(image) { - WikiService.getImage(image).then(data => { - vm.image.push(data.imageinfo); + WikiService.getImage(image).then((response) => { + vm.image.push(response.imageinfo); }); } @@ -77,7 +77,7 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora vm.monument.interwiki = _.mapValues(vm.monument.interwiki, wiki => ({ code: wiki.site.replace('wiki', ''), title: wiki.title, - link: 'https://' + wiki.site.replace('wiki', '') + '.wikipedia.org/wiki/' + wiki.title + link: `https://${wiki.site.replace('wiki', '')}.wikipedia.org/wiki/${wiki.title}`, })); } @@ -117,22 +117,22 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora center: { lat: value.latitude, lng: value.longitude, - zoom: 15 + zoom: 15, }, markers: { marker: { lat: value.latitude, lng: value.longitude, - icon: icon - } - } + icon, + }, + }, }; } getInterwiki(); vm.loading = false; - let title = vm.monument.labels[vm.lang] || vm.monument.labels.en || vm.monument.id; - $window.document.title = title + ' – Monumental'; + const title = vm.monument.labels[vm.lang] || vm.monument.labels.en || vm.monument.id; + $window.document.title = `${title} – Monumental`; }); } } diff --git a/src/components/main/monument/monument.scss b/src/components/main/monument/monument.scss index b07ac68..60dfe4f 100755 --- a/src/components/main/monument/monument.scss +++ b/src/components/main/monument/monument.scss @@ -1,141 +1,141 @@ -@import '../../../styles/variables'; -@import '../../../styles/responsive'; - -mo-monument { - .monument { - width: 980px; - max-width: 100%; - } - - .monument__header { - padding: 25px; - margin-bottom: 15px; - background: white; - border-bottom: 1px solid $softGrey; - - .monument__primary { - margin-bottom: 20px; - border-bottom: 1px solid $softGrey; - } - .monument__secondary { - .material-icons { - margin-right: 5px; - color: $lightGrey; - } - & > div { - margin-bottom: 15px; - } - } - } - - .monument__image { - width: 300px; - height: 300px; - padding: 5px; - margin-right: 25px; - border: 1px solid $softGrey; - } - - .monument__image-link { - background: $softGrey; - width: 100%; - height: 100%; - - img { - max-width: 100%; - max-height: 100%; - } - } - - .monument__panel { - margin: 15px 0; - padding: 30px; - background: white; - border: 1px solid $softGrey; - border-radius: 2px; - } - - - - - .monument__images { - margin-top: 10px; - width: 400px; - - img { - margin-right: 1px; - display: inline-block; - } - } - - .monument__title { - margin-top: 0; - margin-bottom: 0; - } - - .monument__subtitle { - margin-top: 0; - margin-bottom: 15px; - } - - .monument__place { - margin-bottom: 30px !important; - } - - .monument__article { - .article__header { - .md-button.md-primary { - margin-left: 0; - margin-right: 0; - } - } - - .article__text { - position:relative; - max-height: 320px; - overflow: hidden; - font-family: 'Merriweather', serif; - font-size: 15px; - text-align: justify; - line-height: 1.8; - - p:first-child { - margin-top: 0; - } - - &.article__text--long { - max-height: none; - } - - &:after { - content: ""; - position: absolute; top: 0; bottom: 0; left: -15px; right: -15px; - box-shadow: inset rgb(255,255,255) 0 -20px 10px; - } - } - - .md-button { - margin-top: -18px; - } - } - - .monument__details { - .monument__details-item { - margin-bottom: 15px; - - strong { - margin-right: 20px; - } - } - - .monument__details-value { - line-height: 1.5; - } - } - - .angular-leaflet-map { - width: 100%; - height: 300px; - margin-top: 20px; - } +@import '../../../styles/variables'; +@import '../../../styles/responsive'; + +mo-monument { + .monument { + width: 980px; + max-width: 100%; + } + + .monument__header { + padding: 25px; + margin-bottom: 15px; + background: white; + border-bottom: 1px solid $softGrey; + + .monument__primary { + margin-bottom: 20px; + border-bottom: 1px solid $softGrey; + } + .monument__secondary { + .material-icons { + margin-right: 5px; + color: $lightGrey; + } + & > div { + margin-bottom: 15px; + } + } + } + + .monument__image { + width: 300px; + height: 300px; + padding: 5px; + margin-right: 25px; + border: 1px solid $softGrey; + } + + .monument__image-link { + background: $softGrey; + width: 100%; + height: 100%; + + img { + max-width: 100%; + max-height: 100%; + } + } + + .monument__panel { + margin: 15px 0; + padding: 30px; + background: white; + border: 1px solid $softGrey; + border-radius: 2px; + } + + + + + .monument__images { + margin-top: 10px; + width: 400px; + + img { + margin-right: 1px; + display: inline-block; + } + } + + .monument__title { + margin-top: 0; + margin-bottom: 0; + } + + .monument__subtitle { + margin-top: 0; + margin-bottom: 15px; + } + + .monument__place { + margin-bottom: 30px !important; + } + + .monument__article { + .article__header { + .md-button.md-primary { + margin-left: 0; + margin-right: 0; + } + } + + .article__text { + position:relative; + max-height: 320px; + overflow: hidden; + font-family: 'Merriweather', serif; + font-size: 15px; + text-align: justify; + line-height: 1.8; + + p:first-child { + margin-top: 0; + } + + &.article__text--long { + max-height: none; + } + + &:after { + content: ""; + position: absolute; top: 0; bottom: 0; left: -15px; right: -15px; + box-shadow: inset rgb(255,255,255) 0 -20px 10px; + } + } + + .md-button { + margin-top: -18px; + } + } + + .monument__details { + .monument__details-item { + margin-bottom: 15px; + + strong { + margin-right: 20px; + } + } + + .monument__details-value { + line-height: 1.5; + } + } + + .angular-leaflet-map { + width: 100%; + height: 300px; + margin-top: 20px; + } } \ No newline at end of file diff --git a/src/services/index.js b/src/services/index.js index 18b361f..3d53019 100755 --- a/src/services/index.js +++ b/src/services/index.js @@ -1,11 +1,11 @@ -import map from './map.service'; -import theme from './theme.service'; -import wiki from './wiki.service'; -import wikidata from './wikidata.service'; - -export default () => { - map(); - theme(); - wiki(); - wikidata(); -}; +import map from './map.service'; +import theme from './theme.service'; +import wiki from './wiki.service'; +import wikidata from './wikidata.service'; + +export default () => { + map(); + theme(); + wiki(); + wikidata(); +}; diff --git a/src/services/map.service.js b/src/services/map.service.js index 8e3dd11..f3a2055 100755 --- a/src/services/map.service.js +++ b/src/services/map.service.js @@ -1,67 +1,67 @@ -import '../images/marker.png'; - -const MapService = () => { - const service = { - getMapIcon, - getMapInstance, - }; - - return service; - - // - - function getMapIcon(options) { - return angular.extend({ - iconUrl: 'assets/images/marker.png', - shadowUrl: undefined, - iconSize: [40, 40], - shadowSize: [0, 0], - iconAnchor: [20, 20], - shadowAnchor: [0, 0], - }, options); - } - - function getMapInstance(options) { - return angular.extend({ - center: { - lat: 51.686, - lng: 19.545, - zoom: 7, - }, - markers: {}, - layers: { - baselayers: { - osm: { - name: 'OpenStreetMap', - type: 'xyz', - url: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', - layerOptions: { - subdomains: ['a', 'b', 'c'], - attribution: '© OpenStreetMap contributors', - continuousWorld: true, - }, - }, - }, - overlays: { - monuments: { - name: 'Monuments', - type: 'markercluster', - visible: true, - layerOptions: { - spiderfyOnMaxZoom: false, - showCoverageOnHover: false, - zoomToBoundsOnClick: true, - disableClusteringAtZoom: 17, - }, - }, - }, - }, - }, options); - } -}; - -export default () => { - angular - .module('monumental') - .factory('mapService', MapService); -}; +import '../images/marker.png'; + +const MapService = () => { + const service = { + getMapIcon, + getMapInstance, + }; + + return service; + + // + + function getMapIcon(options) { + return angular.extend({ + iconUrl: 'assets/images/marker.png', + shadowUrl: undefined, + iconSize: [40, 40], + shadowSize: [0, 0], + iconAnchor: [20, 20], + shadowAnchor: [0, 0], + }, options); + } + + function getMapInstance(options) { + return angular.extend({ + center: { + lat: 51.686, + lng: 19.545, + zoom: 7, + }, + markers: {}, + layers: { + baselayers: { + osm: { + name: 'OpenStreetMap', + type: 'xyz', + url: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + layerOptions: { + subdomains: ['a', 'b', 'c'], + attribution: '© OpenStreetMap contributors', + continuousWorld: true, + }, + }, + }, + overlays: { + monuments: { + name: 'Monuments', + type: 'markercluster', + visible: true, + layerOptions: { + spiderfyOnMaxZoom: false, + showCoverageOnHover: false, + zoomToBoundsOnClick: true, + disableClusteringAtZoom: 17, + }, + }, + }, + }, + }, options); + } +}; + +export default () => { + angular + .module('monumental') + .factory('mapService', MapService); +}; diff --git a/src/services/theme.service.js b/src/services/theme.service.js index 46fbab3..2d9ed98 100755 --- a/src/services/theme.service.js +++ b/src/services/theme.service.js @@ -1,26 +1,26 @@ -const VersionService = function($timeout, $mdTheming, themeProvider) { - const service = { - version: 'default', - getVersion: getVersion, - setVersion: setVersion - }; - - return service; - - //// - - function getVersion() { - return service.version; - } - - function setVersion(version) { - themeProvider.setDefaultTheme(version); - service.version = version; - } -}; - -export default () => { - angular - .module('monumental') - .factory('versionService', VersionService); -}; +const VersionService = function ($timeout, $mdTheming, themeProvider) { + const service = { + version: 'default', + getVersion, + setVersion, + }; + + return service; + + // + + function getVersion() { + return service.version; + } + + function setVersion(version) { + themeProvider.setDefaultTheme(version); + service.version = version; + } +}; + +export default () => { + angular + .module('monumental') + .factory('versionService', VersionService); +}; diff --git a/src/services/wiki.service.js b/src/services/wiki.service.js index 5ba8c36..ccfd236 100755 --- a/src/services/wiki.service.js +++ b/src/services/wiki.service.js @@ -33,38 +33,38 @@ const WikiService = function ($http, $httpParamSerializerJQLike) { // functions function getArticleHeader(lang, title) { - let params = angular.extend({}, defaultParams, { + const params = angular.extend({}, defaultParams, { prop: 'extracts', titles: title, redirects: true, - exintro: 1 + exintro: 1, }); - return $http.jsonp('https://' + lang + '.wikipedia.org/w/api.php', { - params: params, - cache: true - }).then(data => { - return _.values(data.data.query.pages)[0].extract; + return $http.jsonp(`https://${lang}.wikipedia.org/w/api.php`, { + params, + cache: true, + }).then((response) => { + return _.values(response.data.query.pages)[0].extract; }); } function getCategoryMembers(category) { - let params = angular.extend({}, categoryFilesParams, { cmtitle: 'Category:' + category }); + const params = angular.extend({}, categoryFilesParams, { cmtitle: `Category:${category}` }); return $http.jsonp('https://commons.wikimedia.org/w/api.php', { - params: params, - cache: true - }).then(data => { - let images = data.data.query.categorymembers.map(image => image.title.substring(5)); + params, + cache: true, + }).then((response) => { + const images = response.data.query.categorymembers.map(image => image.title.substring(5)); return images; }); } function getImage(image, extraParams) { - let params = angular.extend({}, imageParams, { titles: 'File:' + image }, extraParams); + const params = angular.extend({}, imageParams, { titles: `File:${image}` }, extraParams); return $http.jsonp('https://commons.wikimedia.org/w/api.php', { - params: params, - cache: true - }).then(data => { - const image = _.head(_.values(data.data.query.pages)); + params, + cache: true, + }).then((response) => { + const image = _.head(_.values(response.data.query.pages)); return angular.extend({}, image, { imageinfo: image.imageinfo[0] }); }); } From 2f4b13d2cc4f5bf936d2f9e55e1717829ee93693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Thu, 16 Mar 2017 18:01:16 +0100 Subject: [PATCH 05/47] chore(app): code lint --- src/index.js | 26 +-- src/index_dev.ejs | 32 +-- src/index_local.ejs | 32 +-- src/services/wikidata.service.js | 380 +++++++++++++++---------------- src/styles/_general.scss | 172 +++++++------- src/styles/_responsive.scss | 38 ++-- src/styles/_variables.scss | 4 +- src/styles/style.scss | 8 +- 8 files changed, 346 insertions(+), 346 deletions(-) diff --git a/src/index.js b/src/index.js index 86a828e..93bc123 100755 --- a/src/index.js +++ b/src/index.js @@ -53,7 +53,7 @@ function localStorageConfig(localStorageServiceProvider) { /** * Config of routing - * + * * @param {any} $stateProvider * @param {any} $urlRouterProvider */ @@ -61,17 +61,17 @@ function stateConfig($stateProvider, $urlRouterProvider) { $stateProvider .state('main', { template: '', - resolve: {} + resolve: {}, }) .state('main.dashboard', { url: '/', - template: ``, - resolve: {} + template: '', + resolve: {}, }) .state('main.list', { url: '/list/:id', - template: ``, - resolve: {} + template: '', + resolve: {}, }) .state('main.map', { url: '/map', @@ -80,23 +80,23 @@ function stateConfig($stateProvider, $urlRouterProvider) { }) .state('main.object', { url: '/object/:id?lang', - template: ``, - resolve: {} + template: '', + resolve: {}, }); $urlRouterProvider.otherwise('/'); } /** * Config of material design theme - * + * * @param {any} $mdThemingProvider * @param {any} $provide */ function themeConfig($mdThemingProvider, $provide) { - let tp = $mdThemingProvider; + const tp = $mdThemingProvider; tp.definePalette('moRed', tp.extendPalette('red', { - '500': '#8f0000', - '600': '#8f0000' + 500: '#8f0000', + 600: '#8f0000', })); tp.alwaysWatchTheme(true); @@ -108,4 +108,4 @@ function themeConfig($mdThemingProvider, $provide) { } components(); -services(); \ No newline at end of file +services(); diff --git a/src/index_dev.ejs b/src/index_dev.ejs index d4c1cb3..491963a 100755 --- a/src/index_dev.ejs +++ b/src/index_dev.ejs @@ -1,17 +1,17 @@ - - - - - - Monumental - - - - - + + + + + + Monumental + + + + + \ No newline at end of file diff --git a/src/index_local.ejs b/src/index_local.ejs index aac40a3..fe95050 100755 --- a/src/index_local.ejs +++ b/src/index_local.ejs @@ -1,17 +1,17 @@ - - - - - - Monumental - - - - - + + + + + + Monumental + + + + + \ No newline at end of file diff --git a/src/services/wikidata.service.js b/src/services/wikidata.service.js index 998a5ab..2a432d3 100755 --- a/src/services/wikidata.service.js +++ b/src/services/wikidata.service.js @@ -1,190 +1,190 @@ -const wdService = function ($http, $q) { - - const service = { - getById: getById, - getLabels: getLabels, - getRecursive: getRecursive, - getSearch: getSearch, - getSPARQL: getSPARQL, - setLanguages: setLanguages - }; - - const defaultParams = { - action: 'wbgetentities', - format: 'json', - props: ['info', 'labels', 'aliases', 'descriptions', 'claims', 'datatype', 'sitelinks'], - languages: ['en'], - callback: 'JSON_CALLBACK' - }; - - /** - * Iterates over own enumerable string keyed properties of an object and - * invokes `func` for each property.. - * - * @param {Object} object The object to iterate over - * @param {Function} func The function invoked per iteration - * @returns {Object} Returns `object` - */ - function forOwn(object, func) { - let key; - for (key in object) { - if (!object.hasOwnProperty(key)) { continue; } - func.call(object, object[key], key); - } - return object; - } - - /** - * - * - * @param {Object} data - * @returns {Promise} - */ - function get(data) { - let params = angular.extend({}, defaultParams, data); - return $http.jsonp('https://www.wikidata.org/w/api.php', { - params: mapValues(params, p => angular.isArray(p) ? p.join('|') : p), - cache: false - }); - } - - function getLabels(ids) { - return get({ - ids: ids, - props: ['labels'] - }).then(response => mapValues(response.data.entities, entity => simplifyLabels(entity.labels))); - } - - function getRecursive(element, recursiveProperty) { - let query = `SELECT ?parent ?parentLabel WHERE { - wd:`+ element + ` wdt:` + recursiveProperty + `* ?parent . - SERVICE wikibase:label { bd:serviceParam wikibase:language "` + defaultParams.languages.join(', ') + `" } - }`; - return getSPARQL(query).then(data => { - return data.map(element => ({ - link: element.parent.value.replace('entity', 'wiki'), - value_id: element.parent.value.substring(element.parent.value.indexOf('/Q') + 1), - value: element.parentLabel.value - })); - }); - } - - function getSearch(text) { - return get({ - action: 'wbsearchentities', - search: text, - type: 'item', - language: defaultParams.languages[0] - }).then(data => data.data.search); - } - - function getSPARQL(query) { - return $http.get('https://query.wikidata.org/sparql', { - params: { query: query }, - cache: false - }).then(data => data.data.results.bindings); - } - - /** - * Creates an object with the same keys as `object` and values generated - * by running each own enumerable string keyed property of `object` thru - * `func`. - * - * @param {Object} object The object to iterate over - * @param {Function} func The function invoked per iteration - * @returns {Object} Returns the new mapped object - */ - function mapValues(object, func) { - let key, result = {}; - for (key in object) { - if (!object.hasOwnProperty(key)) { continue; } - result[key] = func.call(object, object[key], key); - } - return result; - } - - function setLanguages(languages) { - defaultParams.languages = languages; - } - - function simplifyAliases(aliases) { - return mapValues(aliases, lang => lang.map(alias => alias.value)); - } - - function simplifyEntity(entity) { - return { - _raw: entity, - id: entity.id, - labels: simplifyLabels(entity.labels), - aliases: simplifyAliases(entity.aliases), - descriptions: simplifyLabels(entity.descriptions), - claims: simplifyClaims(entity.claims), - interwiki: entity.sitelinks - }; - } - - function simplifyLabels(labels) { - return mapValues(labels, label => label.value); - } - - function simplifyClaim(claim) { - const snak = claim.mainsnak; - return { - value_type: snak.datatype, - value_id: snak.datavalue.value.id, - value: snak.datavalue.value, - qualifiers: claim.qualifiers - }; - } - - function simplifyClaims(claims) { - return mapValues(claims, claim => claim.map(simplifyClaim)); - } - - //function getIDs - - function getById(id) { - let entities = {}; - - return get({ - ids: id, - languages: defaultParams.languages - }) - .then(data => mapValues(data.data.entities, entity => simplifyEntity(entity))) - .then(data => { - entities = data; - const simplified = mapValues(data, - entity => mapValues(entity.claims, - claim => claim.map(value => value.value_id))); - let ids = []; - forOwn(simplified, item => { - ids.push.apply(ids, Object.keys(item)); - forOwn(item, prop => ids.push.apply(ids, prop)); - }); - ids = ids.filter((item, pos, self) => item && self.indexOf(item) === pos); - return ids; - }) - .then(labelsIDs => getLabels(labelsIDs)) - .then(labels => { - forOwn(entities, entity => { - entity.claims = mapValues(entity.claims, (values, key) => ({ - property_id: key, - property: labels[key], - values: values.map(value => labels[value.value_id] ? - angular.extend(value, { value: labels[value.value_id] }) : - value), - qualifiers: entity.qualifiers - })); - }); - return entities; - }); - } - - return service; -}; - -export default () => { - angular - .module('monumental') - .factory('wikidata', wdService); -}; \ No newline at end of file +const wdService = function ($http, $q) { + + const service = { + getById, + getLabels, + getRecursive, + getSearch, + getSPARQL, + setLanguages, + }; + + const defaultParams = { + action: 'wbgetentities', + format: 'json', + props: ['info', 'labels', 'aliases', 'descriptions', 'claims', 'datatype', 'sitelinks'], + languages: ['en'], + callback: 'JSON_CALLBACK', + }; + + /** + * Iterates over own enumerable string keyed properties of an object and + * invokes `func` for each property.. + * + * @param {Object} object The object to iterate over + * @param {Function} func The function invoked per iteration + * @returns {Object} Returns `object` + */ + function forOwn(object, func) { + let key; + for (key in object) { + if (!object.hasOwnProperty(key)) { continue; } + func.call(object, object[key], key); + } + return object; + } + + /** + * + * + * @param {Object} data + * @returns {Promise} + */ + function get(data) { + let params = angular.extend({}, defaultParams, data); + return $http.jsonp('https://www.wikidata.org/w/api.php', { + params: mapValues(params, p => angular.isArray(p) ? p.join('|') : p), + cache: false + }); + } + + function getLabels(ids) { + return get({ + ids: ids, + props: ['labels'] + }).then(response => mapValues(response.data.entities, entity => simplifyLabels(entity.labels))); + } + + function getRecursive(element, recursiveProperty) { + let query = `SELECT ?parent ?parentLabel WHERE { + wd:`+ element + ` wdt:` + recursiveProperty + `* ?parent . + SERVICE wikibase:label { bd:serviceParam wikibase:language "` + defaultParams.languages.join(', ') + `" } + }`; + return getSPARQL(query).then(data => { + return data.map(element => ({ + link: element.parent.value.replace('entity', 'wiki'), + value_id: element.parent.value.substring(element.parent.value.indexOf('/Q') + 1), + value: element.parentLabel.value + })); + }); + } + + function getSearch(text) { + return get({ + action: 'wbsearchentities', + search: text, + type: 'item', + language: defaultParams.languages[0] + }).then(data => data.data.search); + } + + function getSPARQL(query) { + return $http.get('https://query.wikidata.org/sparql', { + params: { query: query }, + cache: false + }).then(data => data.data.results.bindings); + } + + /** + * Creates an object with the same keys as `object` and values generated + * by running each own enumerable string keyed property of `object` thru + * `func`. + * + * @param {Object} object The object to iterate over + * @param {Function} func The function invoked per iteration + * @returns {Object} Returns the new mapped object + */ + function mapValues(object, func) { + let key, result = {}; + for (key in object) { + if (!object.hasOwnProperty(key)) { continue; } + result[key] = func.call(object, object[key], key); + } + return result; + } + + function setLanguages(languages) { + defaultParams.languages = languages; + } + + function simplifyAliases(aliases) { + return mapValues(aliases, lang => lang.map(alias => alias.value)); + } + + function simplifyEntity(entity) { + return { + _raw: entity, + id: entity.id, + labels: simplifyLabels(entity.labels), + aliases: simplifyAliases(entity.aliases), + descriptions: simplifyLabels(entity.descriptions), + claims: simplifyClaims(entity.claims), + interwiki: entity.sitelinks, + }; + } + + function simplifyLabels(labels) { + return mapValues(labels, label => label.value); + } + + function simplifyClaim(claim) { + const snak = claim.mainsnak; + return { + value_type: snak.datatype, + value_id: snak.datavalue.value.id, + value: snak.datavalue.value, + qualifiers: claim.qualifiers, + }; + } + + function simplifyClaims(claims) { + return mapValues(claims, claim => claim.map(simplifyClaim)); + } + + // function getIDs + + function getById(id) { + let entities = {}; + + return get({ + ids: id, + languages: defaultParams.languages, + }) + .then(data => mapValues(data.data.entities, entity => simplifyEntity(entity))) + .then(data => { + entities = data; + const simplified = mapValues(data, + entity => mapValues(entity.claims, + claim => claim.map(value => value.value_id))); + let ids = []; + forOwn(simplified, item => { + ids.push.apply(ids, Object.keys(item)); + forOwn(item, prop => ids.push.apply(ids, prop)); + }); + ids = ids.filter((item, pos, self) => item && self.indexOf(item) === pos); + return ids; + }) + .then(labelsIDs => getLabels(labelsIDs)) + .then(labels => { + forOwn(entities, entity => { + entity.claims = mapValues(entity.claims, (values, key) => ({ + property_id: key, + property: labels[key], + values: values.map(value => labels[value.value_id] ? + angular.extend(value, { value: labels[value.value_id] }) : + value), + qualifiers: entity.qualifiers + })); + }); + return entities; + }); + } + + return service; +}; + +export default () => { + angular + .module('monumental') + .factory('wikidata', wdService); +}; diff --git a/src/styles/_general.scss b/src/styles/_general.scss index 849cc93..c57bd27 100755 --- a/src/styles/_general.scss +++ b/src/styles/_general.scss @@ -1,87 +1,87 @@ -@import 'variables'; - -html, body { - width: 100%; - height: 100%; -} - -body { - color: $darkGrey; - font: 16px Roboto, Arial, sans-serif; -} - -::-webkit-scrollbar { - width: 5px; - background: transparent; -} -::-webkit-scrollbar-thumb { - background: rgba(0,0,0,0.2); -} - -md-content { - margin: 20px; - background: transparent; -} - -.container { - min-height: calc(100vh - 64px); - - ui-view, ui-view > * { - width: 100%; - } -} - -//// - -.link { - cursor: pointer; -} - -a, a.link { - cursor: pointer; - color: rgb(33,150,243); - text-decoration: none; -} - -.muted { - color: $lightGrey; -} - -.full-width { - width: 100%; -} - -.text-left { - text-align: left; -} - -.text-right { - text-align: right; -} - -.invisible { - width: 0; - height: 0; - opacity: 0; -} - -strong { - font-weight: 500; -} - -//// - -.toolbar { - padding: 0 5px; - min-height: 54px; - max-height: 54px; - - .md-toolbar-tools { - max-height: 54px; - height: 54px; - } -} - -.md-virtual-repeat-container.md-autocomplete-suggestions-container { - z-index: 1000 !important; +@import 'variables'; + +html, body { + width: 100%; + height: 100%; +} + +body { + color: $darkGrey; + font: 16px Roboto, Arial, sans-serif; +} + +::-webkit-scrollbar { + width: 5px; + background: transparent; +} +::-webkit-scrollbar-thumb { + background: rgba(0,0,0,0.2); +} + +md-content { + margin: 20px; + background: transparent; +} + +.container { + min-height: calc(100vh - 64px); + + ui-view, ui-view > * { + width: 100%; + } +} + +//// + +.link { + cursor: pointer; +} + +a, a.link { + cursor: pointer; + color: rgb(33,150,243); + text-decoration: none; +} + +.muted { + color: $lightGrey; +} + +.full-width { + width: 100%; +} + +.text-left { + text-align: left; +} + +.text-right { + text-align: right; +} + +.invisible { + width: 0; + height: 0; + opacity: 0; +} + +strong { + font-weight: 500; +} + +//// + +.toolbar { + padding: 0 5px; + min-height: 54px; + max-height: 54px; + + .md-toolbar-tools { + max-height: 54px; + height: 54px; + } +} + +.md-virtual-repeat-container.md-autocomplete-suggestions-container { + z-index: 1000 !important; } \ No newline at end of file diff --git a/src/styles/_responsive.scss b/src/styles/_responsive.scss index 30b2e31..6225702 100755 --- a/src/styles/_responsive.scss +++ b/src/styles/_responsive.scss @@ -1,20 +1,20 @@ -$small: 960px; -$large: 1280px; - -@mixin small { - @media (max-width: #{$small - 1px}) { - @content; - } -} - -@mixin medium { - @media (min-width: #{$small}) and (max-width: #{$large - 1px}) { - @content; - } -} - -@mixin large { - @media (min-width: #{$large}) { - @content; - } +$small: 960px; +$large: 1280px; + +@mixin small { + @media (max-width: #{$small - 1px}) { + @content; + } +} + +@mixin medium { + @media (min-width: #{$small}) and (max-width: #{$large - 1px}) { + @content; + } +} + +@mixin large { + @media (min-width: #{$large}) { + @content; + } } \ No newline at end of file diff --git a/src/styles/_variables.scss b/src/styles/_variables.scss index 7b24a55..0d75d5d 100755 --- a/src/styles/_variables.scss +++ b/src/styles/_variables.scss @@ -1,3 +1,3 @@ -$softGrey: #e5e5e5; -$lightGrey: rgba(0,0,0,0.34); +$softGrey: #e5e5e5; +$lightGrey: rgba(0,0,0,0.34); $darkGrey: rgba(0,0,0,.87); \ No newline at end of file diff --git a/src/styles/style.scss b/src/styles/style.scss index 22ddf95..3016a55 100755 --- a/src/styles/style.scss +++ b/src/styles/style.scss @@ -1,5 +1,5 @@ -@import url('https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&subset=latin,latin-ext'); -@import url('https://fonts.googleapis.com/css?family=Merriweather&subset=cyrillic,cyrillic-ext,latin-ext'); - -@import 'general'; +@import url('https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&subset=latin,latin-ext'); +@import url('https://fonts.googleapis.com/css?family=Merriweather&subset=cyrillic,cyrillic-ext,latin-ext'); + +@import 'general'; @import 'variables'; \ No newline at end of file From 54201945e947a76799db71b78481ce33deb1a22f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sat, 18 Mar 2017 16:16:47 +0100 Subject: [PATCH 06/47] feat(toolbar): separate and redesign toolbar --- src/components/index.js | 4 ++ src/components/main/dashboard/dashboard.html | 5 +-- src/components/main/dashboard/dashboard.js | 14 ------- src/components/main/list/list.html | 24 +----------- src/components/main/list/list.js | 4 -- src/components/main/map/map.html | 24 +----------- src/components/main/map/map.js | 3 -- src/components/main/monument/monument.html | 24 +----------- src/components/toolbar/toolbar.html | 27 ++++++++++++++ src/components/toolbar/toolbar.js | 39 ++++++++++++++++++++ src/components/toolbar/toolbar.scss | 36 ++++++++++++++++++ 11 files changed, 110 insertions(+), 94 deletions(-) create mode 100644 src/components/toolbar/toolbar.html create mode 100644 src/components/toolbar/toolbar.js create mode 100644 src/components/toolbar/toolbar.scss diff --git a/src/components/index.js b/src/components/index.js index 1dfd838..22d64e0 100755 --- a/src/components/index.js +++ b/src/components/index.js @@ -4,10 +4,14 @@ import list from './main/list/list'; import map from './main/map/map'; import monument from './main/monument/monument'; +import toolbar from './toolbar/toolbar'; + export default () => { main(); dashboard(); list(); map(); monument(); + + toolbar(); }; diff --git a/src/components/main/dashboard/dashboard.html b/src/components/main/dashboard/dashboard.html index 91ba722..7fa01b0 100755 --- a/src/components/main/dashboard/dashboard.html +++ b/src/components/main/dashboard/dashboard.html @@ -1,7 +1,4 @@ - -
- Login -
+
diff --git a/src/components/main/dashboard/dashboard.js b/src/components/main/dashboard/dashboard.js index a891226..b3e4c52 100755 --- a/src/components/main/dashboard/dashboard.js +++ b/src/components/main/dashboard/dashboard.js @@ -7,22 +7,8 @@ function controller($state, $window, WikiService, localStorageService) { const vm = this; vm.languages = localStorageService.get('languages') || ['en', 'de']; vm.loading = false; - vm.login = login; vm.saveLanguages = saveLanguages; - init(); - - function init() { - WikiService.getToken().then((data) => { - console.log(data); - }); - } - - function login() { - vm.loading = true; - $window.location.pathname = '/login'; - } - function saveLanguages() { if (vm.languages.includes('en')) { vm.languages.push('en'); diff --git a/src/components/main/list/list.html b/src/components/main/list/list.html index a5dfff4..92f01ce 100755 --- a/src/components/main/list/list.html +++ b/src/components/main/list/list.html @@ -1,26 +1,4 @@ - -
- - Dashboard - - - - - {{item.label}} - {{item.description}} - - -
-
+
diff --git a/src/components/main/list/list.js b/src/components/main/list/list.js index aa77f17..ac88b0e 100755 --- a/src/components/main/list/list.js +++ b/src/components/main/list/list.js @@ -11,10 +11,6 @@ function controller($state, $stateParams, $timeout, leafletData, localStorageSer vm.map = {}; vm.listParams = {}; - vm.goToItem = item => item ? $state.go('main.list', { id: item.id.substring(1) }) : false; - vm.querySearch = text => wikidata.getSearch(text); - vm.search = {}; - const icon = { iconUrl: 'assets/images/marker.png', shadowUrl: undefined, diff --git a/src/components/main/map/map.html b/src/components/main/map/map.html index 1d73374..8094308 100755 --- a/src/components/main/map/map.html +++ b/src/components/main/map/map.html @@ -1,26 +1,4 @@ - -
- - Dashboard - - - - - {{item.label}} - {{item.description}} - - -
-
+
diff --git a/src/components/main/map/map.js b/src/components/main/map/map.js index 6b758a5..e3b4a1c 100755 --- a/src/components/main/map/map.js +++ b/src/components/main/map/map.js @@ -9,14 +9,11 @@ function controller($location, $scope, $state, $stateParams, $timeout, leafletDa // bindings - vm.goToItem = item => setMap(item); vm.map = mapService.getMapInstance({ center: { lat: 49.4967, lng: 12.4805, zoom: 4 } }); - vm.querySearch = text => wikidata.getSearch(text); vm.list = []; vm.listParams = {}; vm.loading = false; vm.loadingMap = true; - vm.search = {}; // activate diff --git a/src/components/main/monument/monument.html b/src/components/main/monument/monument.html index b253080..fe2d974 100755 --- a/src/components/main/monument/monument.html +++ b/src/components/main/monument/monument.html @@ -1,26 +1,4 @@ - -
- - Dashboard - - - -
-
+
diff --git a/src/components/toolbar/toolbar.html b/src/components/toolbar/toolbar.html new file mode 100644 index 0000000..86b9ecc --- /dev/null +++ b/src/components/toolbar/toolbar.html @@ -0,0 +1,27 @@ + +
+
+ + Monumental + +
+ + + {{item.label}} + {{item.description}} + + +
+ Login +
+
\ No newline at end of file diff --git a/src/components/toolbar/toolbar.js b/src/components/toolbar/toolbar.js new file mode 100644 index 0000000..a95014e --- /dev/null +++ b/src/components/toolbar/toolbar.js @@ -0,0 +1,39 @@ +import './toolbar.scss'; +import template from './toolbar.html'; + +const ToolbarComponent = { bindings: { wide: '=' }, controller, template }; + +function controller($mdToast, $state, $window, wikidata) { + const vm = this; + vm.goToItem = goToItem; + vm.querySearch = text => wikidata.getSearch(text); + vm.search = {}; + + function goToItem(item) { + if (!item) { return; } + wikidata.getRecursive(item.id, 'wdt:P31/wdt:P279').then((response) => { + const ids = response.map(prop => prop.value_id); + if (ids.includes('Q811979')) { + $state.go('main.object', { id: item.id.substring(1) }); + } else if (ids.includes('Q1496967')) { + $state.go('main.list', { id: item.id.substring(1) }); + } else { + $mdToast.show($mdToast.simple() + .position('top right') + .textContent(`${item.label} is not an architectural structure or territorial entity`) + .hideDelay(3000000)); + } + }); + } + + function login () { + vm.loading = true; + $window.location.pathname = '/login'; + } +} + +export default () => { + angular + .module('monumental') + .component('moToolbar', ToolbarComponent); +}; diff --git a/src/components/toolbar/toolbar.scss b/src/components/toolbar/toolbar.scss new file mode 100644 index 0000000..1fc944a --- /dev/null +++ b/src/components/toolbar/toolbar.scss @@ -0,0 +1,36 @@ +.toolbar { + padding: 0 5px; + min-height: 54px; + max-height: 54px; + + .md-toolbar-tools-wide { + max-width: none; + } + + md-autocomplete { + background: rgba(255, 255, 255, 0.15); + + md-autocomplete-wrap { + box-shadow: none; + + input { + padding: 0 10px; + color: white; + } + + ::-webkit-input-placeholder { color: rgba(255, 255, 255, 0.75); } + ::-moz-placeholder { color: rgba(255, 255, 255, 0.75); } + :-ms-input-placeholder { color: rgba(255, 255, 255, 0.75); } + :-moz-placeholder { color: rgba(255, 255, 255, 0.75); } + } + } + + .md-toolbar-tools { + max-height: 54px; + height: 54px; + } +} + +.md-virtual-repeat-container.md-autocomplete-suggestions-container { + z-index: 1000 !important; +} From 10cafd0d708f255b04295c8d0f8a041e19e64507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sat, 18 Mar 2017 16:17:33 +0100 Subject: [PATCH 07/47] feat(styles): change primary color --- src/index.js | 8 ++++---- src/styles/_general.scss | 24 ++++-------------------- src/styles/_variables.scss | 4 +++- 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/src/index.js b/src/index.js index 93bc123..7077f59 100755 --- a/src/index.js +++ b/src/index.js @@ -94,14 +94,14 @@ function stateConfig($stateProvider, $urlRouterProvider) { */ function themeConfig($mdThemingProvider, $provide) { const tp = $mdThemingProvider; - tp.definePalette('moRed', tp.extendPalette('red', { - 500: '#8f0000', - 600: '#8f0000', + tp.definePalette('belize', tp.extendPalette('blue', { + 500: '#2980b9', + 600: '#2980b9', })); tp.alwaysWatchTheme(true); tp.theme('default') - .primaryPalette('blue') // moRed + .primaryPalette('belize') .accentPalette('orange'); $provide.value('themeProvider', tp); diff --git a/src/styles/_general.scss b/src/styles/_general.scss index c57bd27..801d1da 100755 --- a/src/styles/_general.scss +++ b/src/styles/_general.scss @@ -1,8 +1,8 @@ @import 'variables'; html, body { - width: 100%; - height: 100%; + min-width: 100%; + min-height: 100%; } body { @@ -24,6 +24,7 @@ md-content { } .container { + background: #f5f5f5; min-height: calc(100vh - 64px); ui-view, ui-view > * { @@ -39,7 +40,7 @@ md-content { a, a.link { cursor: pointer; - color: rgb(33,150,243); + color: $primary; text-decoration: none; } @@ -67,21 +68,4 @@ a, a.link { strong { font-weight: 500; -} - -//// - -.toolbar { - padding: 0 5px; - min-height: 54px; - max-height: 54px; - - .md-toolbar-tools { - max-height: 54px; - height: 54px; - } -} - -.md-virtual-repeat-container.md-autocomplete-suggestions-container { - z-index: 1000 !important; } \ No newline at end of file diff --git a/src/styles/_variables.scss b/src/styles/_variables.scss index 0d75d5d..d503224 100755 --- a/src/styles/_variables.scss +++ b/src/styles/_variables.scss @@ -1,3 +1,5 @@ $softGrey: #e5e5e5; $lightGrey: rgba(0,0,0,0.34); -$darkGrey: rgba(0,0,0,.87); \ No newline at end of file +$darkGrey: rgba(0,0,0,.87); + +$primary: #2980b9 From 968d0a7f01079522227df49c4c522f1bc4a33618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sat, 18 Mar 2017 16:26:28 +0100 Subject: [PATCH 08/47] feat(monument): separate location component --- src/components/index.js | 4 ++ .../main/monument/components/location.js | 43 +++++++++++++++++++ src/components/main/monument/monument.html | 10 +---- src/components/main/monument/monument.js | 10 +---- src/services/wikidata.service.js | 2 +- 5 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 src/components/main/monument/components/location.js diff --git a/src/components/index.js b/src/components/index.js index 22d64e0..5b2371b 100755 --- a/src/components/index.js +++ b/src/components/index.js @@ -2,7 +2,9 @@ import main from './main/main'; import dashboard from './main/dashboard/dashboard'; import list from './main/list/list'; import map from './main/map/map'; + import monument from './main/monument/monument'; +import location from './main/monument/components/location'; import toolbar from './toolbar/toolbar'; @@ -11,7 +13,9 @@ export default () => { dashboard(); list(); map(); + monument(); + location(); toolbar(); }; diff --git a/src/components/main/monument/components/location.js b/src/components/main/monument/components/location.js new file mode 100644 index 0000000..0092ae4 --- /dev/null +++ b/src/components/main/monument/components/location.js @@ -0,0 +1,43 @@ +const LocationComponent = { + bindings: { monument: '=' }, + controller, + template: `
+ location_city + + + {{place.value}} · + + No location provided + +
`, +}; + +function controller(wikidata) { + const vm = this; + init(); + + function init() { + let prop; + let id; + + if (vm.monument.claims.P276) { + prop = 'wdt:P276/wdt:P131'; + id = vm.monument.id; + } else if (vm.monument.claims.P131) { + prop = 'wdt:P131'; + id = vm.monument.claims.P131.values[0].value_id; + } else { + return; + } + + wikidata.getRecursive(id, prop).then((response) => { + vm.location = response; + }); + } +} + +export default () => { + angular + .module('monumental') + .component('moLocation', LocationComponent); +}; diff --git a/src/components/main/monument/monument.html b/src/components/main/monument/monument.html index fe2d974..64aff7a 100755 --- a/src/components/main/monument/monument.html +++ b/src/components/main/monument/monument.html @@ -21,15 +21,7 @@

{{$ctrl.monument.labels.en || '

-
- place - - - {{place.value}} · - - no location - -
+
photo diff --git a/src/components/main/monument/monument.js b/src/components/main/monument/monument.js index cd70279..12d6e3e 100755 --- a/src/components/main/monument/monument.js +++ b/src/components/main/monument/monument.js @@ -60,12 +60,6 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora return `https://commons.wikimedia.org/wiki/Category:${encodeURIComponent(name)}`; } - function getFullLocation(id) { - wikidata.getRecursive(id, 'P131').then((response) => { - vm.location = response; - }); - } - function getImage(image) { WikiService.getImage(image).then((response) => { vm.image.push(response.imageinfo); @@ -94,9 +88,7 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora if (vm.monument.claims.P373) { getCategoryMembers(claims.P373.values[0].value); } - if (vm.monument.claims.P131) { - getFullLocation(claims.P131.values[0].value_id); - } + vm.monument.interwikis = Object.keys(vm.monument.interwiki).length; const articleInterwiki = vm.monument.interwiki[`${langs[0]}wiki`] || vm.monument.interwiki[`${langs[1]}wiki`] || vm.monument.interwiki[`${langs[2]}wiki`]; if (articleInterwiki) { diff --git a/src/services/wikidata.service.js b/src/services/wikidata.service.js index 2a432d3..9145e07 100755 --- a/src/services/wikidata.service.js +++ b/src/services/wikidata.service.js @@ -57,7 +57,7 @@ const wdService = function ($http, $q) { function getRecursive(element, recursiveProperty) { let query = `SELECT ?parent ?parentLabel WHERE { - wd:`+ element + ` wdt:` + recursiveProperty + `* ?parent . + wd:`+ element + ` ` + recursiveProperty + `* ?parent . SERVICE wikibase:label { bd:serviceParam wikibase:language "` + defaultParams.languages.join(', ') + `" } }`; return getSPARQL(query).then(data => { From a8aa93ceff52403c9cbb542616bd3401e52426f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sat, 18 Mar 2017 16:27:22 +0100 Subject: [PATCH 09/47] feat(monument): separate url component --- src/components/index.js | 2 ++ .../main/monument/components/url.js | 28 +++++++++++++++++++ src/components/main/monument/monument.html | 5 +--- 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 src/components/main/monument/components/url.js diff --git a/src/components/index.js b/src/components/index.js index 5b2371b..9c7ca63 100755 --- a/src/components/index.js +++ b/src/components/index.js @@ -5,6 +5,7 @@ import map from './main/map/map'; import monument from './main/monument/monument'; import location from './main/monument/components/location'; +import url from './main/monument/components/url'; import toolbar from './toolbar/toolbar'; @@ -16,6 +17,7 @@ export default () => { monument(); location(); + url(); toolbar(); }; diff --git a/src/components/main/monument/components/url.js b/src/components/main/monument/components/url.js new file mode 100644 index 0000000..a077934 --- /dev/null +++ b/src/components/main/monument/components/url.js @@ -0,0 +1,28 @@ +const UrlComponent = { + bindings: { monument: '<' }, + controller, + template: `
+ link + {{ ::$ctrl.label }} + no official website +
`, +}; + +function controller() { + const vm = this; + init(); + + function init() { + if (vm.monument && vm.monument.claims && vm.monument.claims.P856) { + const values = vm.monument.claims.P856.values; + vm.value = values[0].value; + vm.label = values[0].value.replace(/^https?:\/\/(www\.)?/, ''); + } + } +} + +export default () => { + angular + .module('monumental') + .component('moUrl', UrlComponent); +}; diff --git a/src/components/main/monument/monument.html b/src/components/main/monument/monument.html index 64aff7a..a5c0631 100755 --- a/src/components/main/monument/monument.html +++ b/src/components/main/monument/monument.html @@ -42,10 +42,7 @@

{{$ctrl.monument.labels.en || '

- +
From d74ec62beb38780b084d1b8c6be394ffec2005eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sat, 18 Mar 2017 16:37:43 +0100 Subject: [PATCH 10/47] feat(monument): add photo gallery, visual fixes --- src/components/main/monument/monument.html | 39 +++++++++++++--------- src/components/main/monument/monument.scss | 36 ++++++++++++-------- 2 files changed, 46 insertions(+), 29 deletions(-) diff --git a/src/components/main/monument/monument.html b/src/components/main/monument/monument.html index a5c0631..71dddcd 100755 --- a/src/components/main/monument/monument.html +++ b/src/components/main/monument/monument.html @@ -3,21 +3,23 @@
-
- - - +
+
+ + + +
-
-

{{$ctrl.monument.labels[$ctrl.lang] || 'no name'}}

-

{{$ctrl.monument.labels.en || 'no english name'}}

+
+

{{ ::$ctrl.monument.labels[$ctrl.lang] || "no name" }}

+

{{ ::$ctrl.monument.labels.en || "no english name" }}

- Upload + Wikidata
@@ -25,11 +27,11 @@

{{$ctrl.monument.labels.en || '
photo - {{$ctrl.images.length || 0}} images + {{ $ctrl.images.length || 0 }} images
description - {{$ctrl.monument.interwikis || 0}} wikis + {{ $ctrl.monument.interwikis || 0 }} wikis
@@ -37,7 +39,7 @@

{{$ctrl.monument.labels.en || '
account_balance
@@ -48,9 +50,16 @@

{{$ctrl.monument.labels.en || '

+
+
+ + + +
+
-
@@ -73,7 +82,7 @@

Wikipedia

-
+

Properties

Date: Sat, 18 Mar 2017 20:19:07 +0100 Subject: [PATCH 11/47] feat(services): add wikimedia maps --- src/services/map.service.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/services/map.service.js b/src/services/map.service.js index f3a2055..64bdb97 100755 --- a/src/services/map.service.js +++ b/src/services/map.service.js @@ -31,6 +31,16 @@ const MapService = () => { markers: {}, layers: { baselayers: { + wiki: { + name: 'Wikimedia Maps', + type: 'xyz', + url: '//maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png', + layerOptions: { + subdomains: ['a', 'b', 'c'], + attribution: '© OpenStreetMap contributors', + continuousWorld: true, + }, + }, osm: { name: 'OpenStreetMap', type: 'xyz', From e9fde75e4fcdb3ea705b75c0bb08536543e2cf48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sat, 18 Mar 2017 20:19:33 +0100 Subject: [PATCH 12/47] feat(list): redesign list view --- src/components/main/list/list.html | 116 +++++++++++++++++++---------- src/components/main/list/list.js | 94 ++++++++++------------- src/components/main/list/list.scss | 80 +++++++++++++++++++- 3 files changed, 196 insertions(+), 94 deletions(-) diff --git a/src/components/main/list/list.html b/src/components/main/list/list.html index 92f01ce..88e04f0 100755 --- a/src/components/main/list/list.html +++ b/src/components/main/list/list.html @@ -1,47 +1,87 @@
- -
- - - {{$ctrl.list.length}} results - Loading... - - -
- {{item.name.value}} +
+
+
+
+ + + +
+
+ -
-

{{item.name.value}}

-

{{item.admin.value}}

+
+
+
+
+
+

{{ ::$ctrl.place.labels[$ctrl.lang] || "no name" }}

+

{{ ::$ctrl.place.labels.en }}

- - -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- +
+ Wikidata +
+
+
+ +
+
+
+
+
+ + {{$ctrl.list.length}} results + Loading... +
+
+
+ +
+
+ + +
+ {{ item.name.value }} +
+
+

{{ item.name.value }}

+

{{ item.admin.value }}

+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+
- +
\ No newline at end of file diff --git a/src/components/main/list/list.js b/src/components/main/list/list.js index ac88b0e..933f4e1 100755 --- a/src/components/main/list/list.js +++ b/src/components/main/list/list.js @@ -4,52 +4,16 @@ import '../../../images/marker.png'; const ListComponent = { controller, template }; -function controller($state, $stateParams, $timeout, leafletData, localStorageService, wikidata) { +function controller($state, $stateParams, $timeout, leafletData, localStorageService, mapService, WikiService, wikidata) { const vm = this; - const id = $stateParams.id[0] === 'Q' ? $stateParams.id : 'Q' + $stateParams.id; + const icon = mapService.getMapIcon(); + const id = $stateParams.id.includes('Q') ? $stateParams.id : `Q${$stateParams.id}`; - vm.map = {}; + vm.filters = {}; + vm.image = []; + vm.map = mapService.getMapInstance({ center: { lat: 49.4967, lng: 12.4805, zoom: 4 } }); vm.listParams = {}; - const icon = { - iconUrl: 'assets/images/marker.png', - shadowUrl: undefined, - iconSize: [40, 40], - shadowSize: [0, 0], - iconAnchor: [20, 20], - shadowAnchor: [0, 0], - }; - - vm.map = { - center: { - lat: 51.686, - lng: 19.545, - zoom: 7, - }, - markers: {}, - layers: { - baselayers: { - osm: { - name: 'OpenStreetMap', - type: 'xyz', - url: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', - layerOptions: { - subdomains: ['a', 'b', 'c'], - attribution: '© OpenStreetMap contributors', - continuousWorld: true, - }, - }, - }, - overlays: { - monuments: { - name: 'Monuments', - type: 'markercluster', - visible: true, - }, - }, - }, - }; - if (!id || id === 'Q') { vm.showMap = true; return; @@ -57,24 +21,45 @@ function controller($state, $stateParams, $timeout, leafletData, localStorageSer let langs = $stateParams.lang ? [$stateParams.lang] : []; langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); + vm.lang = langs[0]; wikidata.setLanguages(langs); - wikidata.getSearch(id).then((results) => { - vm.search.selectedItem = results.length ? results[0] : undefined; - }); + init(); + + function getImage(image) { + WikiService.getImage(image).then((response) => { + vm.image.push(response.imageinfo); + }); + } - wikidata.getSPARQL(`SELECT DISTINCT ?item ?itemLabel (SAMPLE(?admin) AS ?admin) (SAMPLE(?adminLabel) AS ?adminLabel) (SAMPLE(?coord) AS ?coord) (SAMPLE(?image) AS ?image) + function getList() { + return wikidata.getSPARQL(`SELECT DISTINCT ?item ?itemLabel + (SAMPLE(?admin) AS ?admin) (SAMPLE(?adminLabel) AS ?adminLabel) (SAMPLE(?coord) AS ?coord) (SAMPLE(?image) AS ?image) WHERE { - ?item p:P1435 ?monument . - ?item wdt:P131* wd:${id} . - ?item wdt:P131 ?admin . - ?item wdt:P625 ?coord . - OPTIONAL { ?item wdt:P18 ?image } - OPTIONAL { ?admin rdfs:label ?adminLabel. FILTER(LANG(?adminLabel) = "${langs[0]}"). } - SERVICE wikibase:label { bd:serviceParam wikibase:language "${langs.join(',')}" } + ?item p:P1435 ?monument; wdt:P131* wd:${id}; wdt:P131 ?admin; wdt:P625 ?coord . + OPTIONAL { ?item wdt:P18 ?image } + OPTIONAL { ?admin rdfs:label ?adminLabel. FILTER(LANG(?adminLabel) = "${langs[0]}"). } + SERVICE wikibase:label { bd:serviceParam wikibase:language "${langs.join(',')}" } } GROUP BY ?item ?itemLabel - ORDER BY ?itemLabel`).then((data) => { + ORDER BY ?itemLabel`); + } + + function getPlace() { + wikidata.getById(id).then((data) => { + const first = Object.keys(data)[0]; + vm.place = data[first]; + + if (vm.place.claims.P18) { + const claims = vm.place.claims; + claims.P18.values.forEach(image => getImage(image.value)); + } + }); + } + + function init() { + getPlace(); + getList().then((data) => { // console.log(data) vm.list = data.map(element => ({ name: { @@ -122,6 +107,7 @@ function controller($state, $stateParams, $timeout, leafletData, localStorageSer }); }); }); + } } export default () => { diff --git a/src/components/main/list/list.scss b/src/components/main/list/list.scss index 35a28ff..6733f43 100755 --- a/src/components/main/list/list.scss +++ b/src/components/main/list/list.scss @@ -4,11 +4,85 @@ mo-list { .list { width: 450px; - height: calc(100vh - 105px); + } + + .list__header { + padding: 20px 25px; + background: white; + border-bottom: 1px solid $softGrey; + + .header__primary { + margin-bottom: 10px; + border-bottom: 1px solid $softGrey; + } + + .header__secondary { + .material-icons { + margin-right: 5px; + color: $lightGrey; + } + & > div { + margin-bottom: 15px; + } + } + + .header__image { + width: 100px; + height: 100px; + padding: 5px; + margin-right: 25px; + border: 1px solid $softGrey; + } + + .header__image-link { + background: $softGrey; + width: 100%; + height: 100%; + + img { + max-width: 100%; + max-height: 100%; + } + } + + .header__title { + margin-top: 0; + margin-bottom: 0; + font-size: 32px; + line-height: 32px; + } + + .header__subtitle { + margin-top: 0; + margin-bottom: 10px; + } + + .header__place { + display: block; + } + } + + .list__subheader { + padding: 15px 25px; + background: #fafafa; + border-bottom: 1px solid $softGrey; + + md-input-container { + margin-bottom: 0; + margin-top: 0; + padding: 0; + + .md-errors-spacer { + display: none; + } + } } .list__container { margin-right: 20px; + background: white; + border: 1px solid $softGrey; + border-radius: 2px; md-list-item.md-2-line { border-bottom: 1px solid $softGrey; @@ -29,7 +103,9 @@ mo-list { } .list__map { - background: $softGrey; + background: white; + border: 1px solid $softGrey; + border-radius: 2px; .angular-leaflet-map { width: 100%; From 275a1cc9508f575d63eadc2ad1ab79132dd67574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sun, 19 Mar 2017 00:43:27 +0100 Subject: [PATCH 13/47] feat(toolbar): move toolbar position --- src/components/main/dashboard/dashboard.html | 1 - src/components/main/list/list.html | 1 - src/components/main/main.html | 1 + src/components/main/map/map.html | 1 - src/components/main/monument/monument.html | 1 - src/components/toolbar/toolbar.html | 2 +- 6 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/components/main/dashboard/dashboard.html b/src/components/main/dashboard/dashboard.html index 7fa01b0..1ed2955 100755 --- a/src/components/main/dashboard/dashboard.html +++ b/src/components/main/dashboard/dashboard.html @@ -1,4 +1,3 @@ -
diff --git a/src/components/main/list/list.html b/src/components/main/list/list.html index 88e04f0..87d18ed 100755 --- a/src/components/main/list/list.html +++ b/src/components/main/list/list.html @@ -1,4 +1,3 @@ -
diff --git a/src/components/main/main.html b/src/components/main/main.html index be33d1c..a0cdefa 100755 --- a/src/components/main/main.html +++ b/src/components/main/main.html @@ -1 +1,2 @@ + \ No newline at end of file diff --git a/src/components/main/map/map.html b/src/components/main/map/map.html index 8094308..352b8a3 100755 --- a/src/components/main/map/map.html +++ b/src/components/main/map/map.html @@ -1,4 +1,3 @@ -
diff --git a/src/components/main/monument/monument.html b/src/components/main/monument/monument.html index 71dddcd..91e4d29 100755 --- a/src/components/main/monument/monument.html +++ b/src/components/main/monument/monument.html @@ -1,4 +1,3 @@ -
diff --git a/src/components/toolbar/toolbar.html b/src/components/toolbar/toolbar.html index 86b9ecc..19591ce 100644 --- a/src/components/toolbar/toolbar.html +++ b/src/components/toolbar/toolbar.html @@ -1,6 +1,6 @@
+ ng-class="{ 'md-toolbar-tools-wide': ('main.list' | includedByState) || ('main.map' | includedByState) }">
Monumental From ab3883634f15e756ad0f97be6084cf8d42d066a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 20 Mar 2017 19:43:51 +0100 Subject: [PATCH 14/47] fix(monument): get single main image --- src/components/main/monument/monument.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/main/monument/monument.js b/src/components/main/monument/monument.js index 12d6e3e..8ecfe62 100755 --- a/src/components/main/monument/monument.js +++ b/src/components/main/monument/monument.js @@ -8,7 +8,7 @@ const MonumentComponent = { controller, template }; function controller($http, $q, $sce, $stateParams, $timeout, $window, localStorageService, WikiService, wikidata) { const vm = this; - const id = $stateParams.id[0] === 'Q' ? $stateParams.id : `Q${$stateParams.id}`; + const id = $stateParams.id.includes('Q') ? $stateParams.id : `Q${$stateParams.id}`; vm.getCommonsLink = getCommonsLink; vm.image = []; @@ -83,7 +83,8 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora const claims = vm.monument.claims; if (vm.monument.claims.P18) { - claims.P18.values.forEach(image => getImage(image.value)); + getImage(claims.P18.values[0].value); + // claims.P18.values.forEach(image => getImage(image.value)); } if (vm.monument.claims.P373) { getCategoryMembers(claims.P373.values[0].value); From 237e5c6bc509b20e9feba63ed1d00c59ae1cb3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 20 Mar 2017 19:48:41 +0100 Subject: [PATCH 15/47] feat(toolbar): add login --- src/components/toolbar/toolbar.html | 9 +++++++-- src/components/toolbar/toolbar.js | 21 ++++++++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/components/toolbar/toolbar.html b/src/components/toolbar/toolbar.html index 19591ce..0efbef5 100644 --- a/src/components/toolbar/toolbar.html +++ b/src/components/toolbar/toolbar.html @@ -22,6 +22,11 @@
- Login + Logged In + Login
-
\ No newline at end of file +
+
+
+ Settings +
\ No newline at end of file diff --git a/src/components/toolbar/toolbar.js b/src/components/toolbar/toolbar.js index a95014e..311dd15 100644 --- a/src/components/toolbar/toolbar.js +++ b/src/components/toolbar/toolbar.js @@ -3,11 +3,19 @@ import template from './toolbar.html'; const ToolbarComponent = { bindings: { wide: '=' }, controller, template }; -function controller($mdToast, $state, $window, wikidata) { +function controller($mdToast, $state, $window, WikiService, wikidata) { const vm = this; + vm.isLoggedIn = false; + vm.loading = true; + vm.search = {}; + + // functions + vm.goToItem = goToItem; + vm.login = login; vm.querySearch = text => wikidata.getSearch(text); - vm.search = {}; + + init(); function goToItem(item) { if (!item) { return; } @@ -26,7 +34,14 @@ function controller($mdToast, $state, $window, wikidata) { }); } - function login () { + function init() { + WikiService.getToken().then((response) => { + vm.isLoggedIn = response; + vm.loading = false; + }); + } + + function login() { vm.loading = true; $window.location.pathname = '/login'; } From f4ab24cfe4ee1239edbbd376d9aa114affcf32b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 20 Mar 2017 19:49:37 +0100 Subject: [PATCH 16/47] fix(monument): disable wikipedia article trim due to glitch --- src/components/main/monument/monument.scss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/main/monument/monument.scss b/src/components/main/monument/monument.scss index a466f1a..583aee5 100755 --- a/src/components/main/monument/monument.scss +++ b/src/components/main/monument/monument.scss @@ -116,9 +116,9 @@ mo-monument { } &:after { - content: ""; - position: absolute; top: 0; bottom: 0; left: -15px; right: -15px; - box-shadow: inset rgb(255,255,255) 0 -20px 10px; + // content: ""; + // position: absolute; top: 0; bottom: 0; left: -15px; right: -15px; + // box-shadow: inset rgb(255,255,255) 0 -20px 10px; } } From e0ea0e372207be525d26df5e3e45ec64adbbc0e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 20 Mar 2017 19:50:07 +0100 Subject: [PATCH 17/47] feat(services): add user info request --- src/services/wiki.service.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/services/wiki.service.js b/src/services/wiki.service.js index ccfd236..15eca53 100755 --- a/src/services/wiki.service.js +++ b/src/services/wiki.service.js @@ -5,6 +5,7 @@ const WikiService = function ($http, $httpParamSerializerJQLike) { getArticleHeader, getCategoryMembers, getImage, + getUserInfo, getToken, setClaim, }; @@ -69,6 +70,15 @@ const WikiService = function ($http, $httpParamSerializerJQLike) { }); } + function getUserInfo(extraParams) { + const params = angular.extend({}, defaultParams, { + meta: 'userinfo|globaluserinfo', + }, extraParams); + return $http.jsonp('https://wikidata.org/w/api.php', { + params, + }).then(response => response.data.query.globaluserinfo); + } + function getToken() { return $http.get('/api', { params: { From f57a9199208ec691abd2c7a8cc88cfdbfcde04fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 20 Mar 2017 19:50:37 +0100 Subject: [PATCH 18/47] fix(services): optimize sparql query --- src/services/wikidata.service.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/wikidata.service.js b/src/services/wikidata.service.js index 9145e07..c479bb7 100755 --- a/src/services/wikidata.service.js +++ b/src/services/wikidata.service.js @@ -80,8 +80,8 @@ const wdService = function ($http, $q) { function getSPARQL(query) { return $http.get('https://query.wikidata.org/sparql', { - params: { query: query }, - cache: false + params: { query: query.replace(/ {2,}/g, ' ') }, + cache: false, }).then(data => data.data.results.bindings); } From dea0ac459829802bfb464f59f2fcdd777c2d79eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 20 Mar 2017 20:58:24 +0100 Subject: [PATCH 19/47] feat(toolbar): styling, add logout --- src/components/toolbar/toolbar.html | 4 ++-- src/components/toolbar/toolbar.js | 5 +++++ src/components/toolbar/toolbar.scss | 8 ++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/toolbar/toolbar.html b/src/components/toolbar/toolbar.html index 0efbef5..ca3f0ad 100644 --- a/src/components/toolbar/toolbar.html +++ b/src/components/toolbar/toolbar.html @@ -27,6 +27,6 @@
-
- Settings +
+ Logout
\ No newline at end of file diff --git a/src/components/toolbar/toolbar.js b/src/components/toolbar/toolbar.js index 311dd15..ef08059 100644 --- a/src/components/toolbar/toolbar.js +++ b/src/components/toolbar/toolbar.js @@ -13,6 +13,7 @@ function controller($mdToast, $state, $window, WikiService, wikidata) { vm.goToItem = goToItem; vm.login = login; + vm.logout = logout; vm.querySearch = text => wikidata.getSearch(text); init(); @@ -45,6 +46,10 @@ function controller($mdToast, $state, $window, WikiService, wikidata) { vm.loading = true; $window.location.pathname = '/login'; } + + function logout() { + $window.location.pathname = '/logout'; + } } export default () => { diff --git a/src/components/toolbar/toolbar.scss b/src/components/toolbar/toolbar.scss index 1fc944a..a258fba 100644 --- a/src/components/toolbar/toolbar.scss +++ b/src/components/toolbar/toolbar.scss @@ -34,3 +34,11 @@ .md-virtual-repeat-container.md-autocomplete-suggestions-container { z-index: 1000 !important; } + +.toolbar__settings { + position: absolute; + width: calc(100% - 50px); + z-index: 10; + padding: 20px 25px; + background: white; +} \ No newline at end of file From 126bdcf271c8ae7132ea1110fcb0f2ad2de40acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Thu, 23 Mar 2017 23:01:36 +0100 Subject: [PATCH 20/47] fix(services): fix no value snak --- src/services/wikidata.service.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/services/wikidata.service.js b/src/services/wikidata.service.js index c479bb7..cf09a10 100755 --- a/src/services/wikidata.service.js +++ b/src/services/wikidata.service.js @@ -131,9 +131,10 @@ const wdService = function ($http, $q) { const snak = claim.mainsnak; return { value_type: snak.datatype, - value_id: snak.datavalue.value.id, - value: snak.datavalue.value, + value_id: snak.snaktype === 'novalue' ? false : snak.datavalue.value.id, + value: snak.snaktype === 'novalue' ? false : snak.datavalue.value, qualifiers: claim.qualifiers, + rank: claim.rank, }; } @@ -157,7 +158,7 @@ const wdService = function ($http, $q) { entity => mapValues(entity.claims, claim => claim.map(value => value.value_id))); let ids = []; - forOwn(simplified, item => { + forOwn(simplified, (item) => { ids.push.apply(ids, Object.keys(item)); forOwn(item, prop => ids.push.apply(ids, prop)); }); @@ -165,15 +166,15 @@ const wdService = function ($http, $q) { return ids; }) .then(labelsIDs => getLabels(labelsIDs)) - .then(labels => { - forOwn(entities, entity => { + .then((labels) => { + forOwn(entities, (entity) => { entity.claims = mapValues(entity.claims, (values, key) => ({ property_id: key, property: labels[key], values: values.map(value => labels[value.value_id] ? angular.extend(value, { value: labels[value.value_id] }) : value), - qualifiers: entity.qualifiers + qualifiers: entity.qualifiers, })); }); return entities; From dd6254e5bd96dc57f58772d7835db3b584360c69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Thu, 23 Mar 2017 23:02:21 +0100 Subject: [PATCH 21/47] fix(monument): use preferred value --- src/components/main/monument/components/location.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/main/monument/components/location.js b/src/components/main/monument/components/location.js index 0092ae4..49f1dd7 100644 --- a/src/components/main/monument/components/location.js +++ b/src/components/main/monument/components/location.js @@ -25,7 +25,8 @@ function controller(wikidata) { id = vm.monument.id; } else if (vm.monument.claims.P131) { prop = 'wdt:P131'; - id = vm.monument.claims.P131.values[0].value_id; + const preferred = vm.monument.claims.P131.values.filter(value => value.rank === 'preferred'); + id = preferred.length ? preferred[0].value_id : vm.monument.claims.P131.values[0].value_id; } else { return; } From 699a7282c529c8a180f79f55a1e23794a2b950c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Fri, 24 Mar 2017 20:02:04 +0100 Subject: [PATCH 22/47] feat(dashboard): clean-up dashboard links --- src/components/main/dashboard/dashboard.html | 491 ------------------- 1 file changed, 491 deletions(-) diff --git a/src/components/main/dashboard/dashboard.html b/src/components/main/dashboard/dashboard.html index 1ed2955..08e09fc 100755 --- a/src/components/main/dashboard/dashboard.html +++ b/src/components/main/dashboard/dashboard.html @@ -120,497 +120,6 @@

Europe

İzmir (Turkey)Łódź (Poland)
-
-

Africa

- Abeokuta (Nigeria) • - Abidjan (Côte d'Ivoire) • - Abuja (Nigeria) • - Accra (Ghana) • - Addis Ababa (Ethiopia) • - Agadir (Morocco) • - Alexandria (Egypt) • - Algiers (Algeria) • - Antananarivo (Madagascar) • - Asmara (Eritrea) • - Bangui (Central African Republic) • - Benghazi (Libya) • - Blantyre (Malawi) • - Bouaké (Côte d'Ivoire) • - Brazzaville (Republic of the Congo) • - Bujumbura (Burundi) • - Bulawayo (Zimbabwe) • - Cairo (Egypt) • - Conakry (Guinea) • - Dar es Salaam (Tanzania) • - Djibouti (Djibouti) • - Douala (Cameroon) • - Fes (Morocco) • - Freetown (Sierra Leone) • - Giza (Egypt) • - Harare (Zimbabwe) • - Helwan (Egypt) • - Ife (Nigeria) • - Ilorin (Nigeria) • - Johannesburg (South Africa) • - Jos (Nigeria) • - Kaduna (Nigeria) • - Kampala (Uganda) • - Khartoum (Sudan) • - Khartoum North (Sudan) • - Kigali (Rwanda) • - Kinshasa (Democratic Republic of the Congo) • - Kitwe (Zambia) • - Kumasi (Ghana) • - Lagos (Nigeria) • - Libreville (Gabon) • - Lilongwe (Malawi) • - Lomé (Togo) • - Luanda (Angola) • - Lubumbashi (Democratic Republic of the Congo) • - Lusaka (Zambia) • - Maiduguri (Nigeria) • - Maputo (Mozambique) • - Marrakesh (Morocco) • - Matola (Mozambique) • - Mombasa (Kenya) • - Monrovia (Liberia) • - N'Djamena (Chad) • - Nairobi (Kenya) • - Niamey (Niger) • - Nouakchott (Mauritania) • - Ogbomosho (Nigeria) • - Omdurman (Sudan) • - Ouagadougou (Burkina Faso) • - Port Said (Egypt) • - Pretoria (South Africa) • - Rabat (Morocco) • - Sekondi-Takoradi (Ghana) • - Shubra El-Kheima (Egypt) • - Tripoli (Libya) • - Yaoundé (Cameroon) -
-
-

Asia

- Abu Dhabi (United Arab Emirates) • - Adana (Turkey) • - Aden (Yemen) • - Agartala (India) • - Agra (India) • - Ahvaz (Iran) • - Al Ain (United Arab Emirates) • - Al Hudaydah (Yemen) • - Aleppo (Syria) • - Alexandria (Egypt) • - Almaty (Kazakhstan) • - Amman (Jordan) • - An Najaf (Iraq) • - Ankara (Turkey) • - Antalya (Turkey) • - Antipolo (Philippines) • - Astana (Kazakhstan) • - Astrakhan (Russia) • - Aurangabad (India) • - Bacolod (Philippines) • - Bacoor (Philippines) • - Baghdad (Iraq) • - Baku (Azerbaijan) • - Balikpapan (Indonesia) • - Balıkesir (Turkey) • - Bandarlampung (Indonesia) • - Bandung (Indonesia) • - Bangalore (India) • - Bangkok (Thailand) • - Banjarmasin (Indonesia) • - Bareilly (India) • - Barnaul (Russia) • - Batam (Indonesia) • - Beijing (People's Republic of China) • - Bekasi (Indonesia) • - Bhiwandi (India) • - Bishkek (Kyrgyzstan) • - Bogor (Indonesia) • - Bursa (Turkey) • - Busan (South Korea) • - Cagayan de Oro (Philippines) • - Cairo (Egypt) • - Caloocan (Philippines) • - Cebu City (Philippines) • - Chandigarh (India) • - Changde (People's Republic of China) • - Chelyabinsk (Russia) • - Chennai (India) • - Cheongju (South Korea) • - Chiba (Japan) • - Chongqing (People's Republic of China) • - Cimahi (Indonesia) • - Coimbatore (India) • - Colombo (Sri Lanka) • - Cần Thơ (Vietnam) • - Damascus (Syria) • - Daqing (People's Republic of China) • - Dasmariñas (Philippines) • - Davao City (Philippines) • - Delhi (India) • - Denizli (Turkey) • - Denpasar (Indonesia) • - Depok (Indonesia) • - Dhaka (Bangladesh) • - Doha (Qatar) • - Dubai (United Arab Emirates) • - Dushanbe (Tajikistan) • - Erbil (Iraq) • - Faisalabad (Pakistan) • - Fukuoka (Japan) • - Funabashi (Japan) • - Fuzhou (People's Republic of China) • - Ganja (Azerbaijan) • - Gaza City (Palestine) • - Gaziantep (Turkey) • - General Santos (Philippines) • - George Town (Malaysia) • - Giza (Egypt) • - Goyang (South Korea) • - Gujranwala (Pakistan) • - Guntur (India) • - Hachiōji City (Japan) • - Haiphong (Vietnam) • - Hamamatsu (Japan) • - Hamhung (North Korea) • - Hanoi (Vietnam) • - Hefei (People's Republic of China) • - Helwan (Egypt) • - Higashiōsaka (Japan) • - Himeji (Japan) • - Hiroshima (Japan) • - Ho Chi Minh City (Vietnam) • - Homs (Syria) • - Hyderabad (India) • - Hyderabad (Pakistan) • - Irbid (Jordan) • - Isfahan (Iran) • - Islamabad (Pakistan) • - Istanbul (Turkey) • - Jaipur (India) • - Jakarta (Indonesia) • - Jambi (Indonesia) • - Jeddah (Saudi Arabia) • - Jeonju (South Korea) • - Jerusalem (Israel) • - Jerusalem (Jordan) • - Jerusalem (Palestine) • - Jodhpur (India) • - Kabul (Afghanistan) • - Kagoshima (Japan) • - Kaifeng (People's Republic of China) • - Kaohsiung City (Taiwan) • - Karachi (Pakistan) • - Karaj (Iran) • - Kathmandu (Nepal) • - Kawaguchi (Japan) • - Kawasaki (Japan) • - Kayseri (Turkey) • - Kazan (Russia) • - Kemerovo (Russia) • - Kermanshah (Iran) • - Khabarovsk (Russia) • - Khulna (Bangladesh) • - Kirkuk (Iraq) • - Kitakyūshū (Japan) • - Klang (Malaysia) • - Kolkata (India) • - Krasnoyarsk (Russia) • - Kuala Lumpur (Malaysia) • - Kuantan (Malaysia) • - Kumamoto (Japan) • - Kuwait City (Kuwait) • - Kyoto (Japan) • - Kōbe (Japan) • - Lanzhou (People's Republic of China) • - Las Piñas (Philippines) • - Latakia (Syria) • - Macau (People's Republic of China) • - Makassar (Indonesia) • - Makati (Philippines) • - Makhachkala (Russia) • - Malang (Indonesia) • - Mandalay (Myanmar) • - Manila (Philippines) • - Matsuyama (Japan) • - Mawlamyine (Myanmar) • - Mecca (Saudi Arabia) • - Medan (Indonesia) • - Moscow (Russia) • - Mosul (Iraq) • - Mumbai (India) • - Muntinlupa (Philippines) • - Mysore (India) • - Naberezhnye Chelny (Russia) • - Nagoya (Japan) • - Nantong (People's Republic of China) • - Naypyidaw (Myanmar) • - Niigata (Japan) • - Nizhny Novgorod (Russia) • - Novosibirsk (Russia) • - Okayama (Japan) • - Omsk (Russia) • - Palembang (Indonesia) • - Parañaque (Philippines) • - Pasig (Philippines) • - Pekanbaru (Indonesia) • - Penza (Russia) • - Perm (Russia) • - Peshawar (Pakistan) • - Petaling Jaya (Malaysia) • - Phnom Penh (Cambodia) • - Pohang (South Korea) • - Pontianak (Indonesia) • - Port Said (Egypt) • - Pune (India) • - Pyongyang (North Korea) • - Qiqihar (People's Republic of China) • - Quetta (Pakistan) • - Quezon City (Philippines) • - Ranchi (India) • - Rawalpindi (Pakistan) • - Riyadh (Saudi Arabia) • - Rostov-on-Don (Russia) • - Sagamihara (Japan) • - Saint Petersburg (Russia) • - Saitama (Japan) • - Sakai City (Japan) • - Samara (Russia) • - Samarinda (Indonesia) • - Samarkand (Uzbekistan) • - San Jose del Monte (Philippines) • - Sana'a (Yemen) • - Sapporo (Japan) • - Sargodha (Pakistan) • - Semarang (Indonesia) • - Sendai (Japan) • - Seoul (South Korea) • - Serang (Indonesia) • - Shanghai (People's Republic of China) • - Shantou (People's Republic of China) • - Shaoxing (People's Republic of China) • - Shiraz (Iran) • - Shizuoka (Japan) • - Shubra El-Kheima (Egypt) • - Shymkent (Kazakhstan) • - Sialkot (Pakistan) • - Singapore (Singapore) • - Surabaya (Indonesia) • - Surakarta (Indonesia) • - Ta'izz (Yemen) • - Taguig (Philippines) • - Taipei (Taiwan) • - Tangerang (Indonesia) • - Tangerang Selatan (Indonesia) • - Taoyuan District (Taiwan) • - Tashkent (Uzbekistan) • - Tasikmalaya (Indonesia) • - Tehran (Iran) • - Tianjin (People's Republic of China) • - Tokyo (Japan) • - Tokyo (Japan) • - Tolyatti (Russia) • - Trichy (India) • - Trichy (Tamil Nadu) • - Tyumen (Russia) • - Ufa (Russia) • - Ulaanbaatar (Mongolia) • - Ulsan (South Korea) • - Ulyanovsk (Russia) • - Utsunomiya (Japan) • - Valenzuela (Philippines) • - Varanasi (India) • - Vientiane (Laos) • - Vijayawada (India) • - Visakhapatnam (India) • - Vladivostok (Russia) • - Volgograd (Russia) • - Voronezh (Russia) • - Wenzhou (People's Republic of China) • - Wuhu (People's Republic of China) • - Yancheng (People's Republic of China) • - Yangon (Myanmar) • - Yaroslavl (Russia) • - Yazd (Iran) • - Yekaterinburg (Russia) • - Yokohama (Japan) • - Yongin (South Korea) • - Zamboanga City (Philippines) • - Zhengzhou (People's Republic of China) • - Zibo (People's Republic of China) • - İzmir (Turkey) • - Ōsaka (Japan) -
-
-

Central America

- Emilce nombre unico (Guatemala) • - Guatemala City (Guatemala) • - Havana (Cuba) • - Santiago de Cuba (Cuba) -
-
-

North America

- Acapulco (Mexico) • - Albuquerque (United States of America) • - Austin (United States of America) • - Baltimore (United States of America) • - Boston (United States of America) • - Calgary (Canada) • - Carrefour (Haiti) • - Chicago (United States of America) • - Chihuahua (Mexico) • - Ciudad Nezahualcóyotl (Mexico) • - Columbus (United States of America) • - Culiacán (Mexico) • - Dallas (United States of America) • - Denver (United States of America) • - Detroit (United States of America) • - Ecatepec de Morelos (Mexico) • - Edmonton (Canada) • - El Paso (United States of America) • - Ensenada (Mexico) • - Fort Worth (United States of America) • - Hamilton (Canada) • - Hermosillo (Mexico) • - Houston (United States of America) • - Indianapolis (United States of America) • - Jacksonville (United States of America) • - Kingston (Jamaica) • - Las Vegas (United States of America) • - León (Mexico) • - Los Angeles (United States of America) • - Louisville (United States of America) • - Managua (Nicaragua) • - Memphis (United States of America) • - Mexico City (Mexico) • - Milwaukee (United States of America) • - Mississauga (Canada) • - Monterrey (Mexico) • - Montreal (Canada) • - Nashville (United States of America) • - New York City (United States of America) • - Oklahoma City (United States of America) • - Ottawa (Canada) • - Panama City (Panama) • - Philadelphia (United States of America) • - Phoenix (United States of America) • - Port-au-Prince (Haiti) • - Portland (United States of America) • - Quebec City (Canada) • - San Antonio (United States of America) • - San Diego (United States of America) • - San Francisco (United States of America) • - San Jose (United States of America) • - San Pedro Sula (Honduras) • - San Salvador (El Salvador) • - Santiago de los Caballeros (Dominican Republic) • - Santo Domingo (Dominican Republic) • - Seattle (United States of America) • - Tegucigalpa (Honduras) • - Tlaquepaque (Mexico) • - Toronto (Canada) • - Tucson (United States of America) • - Tultitlán de Mariano Escobedo (Mexico) • - Tuxtla Gutiérrez (Mexico) • - Vancouver (Canada) • - Washington, D.C. (United States of America) • - Winnipeg (Canada) • - Xalapa (Mexico) • - Zapopan (Mexico) -
-
-

Oceania

- Adelaide (Australia) • - Albuquerque (United States of America) • - Auckland (New Zealand) • - Austin (United States of America) • - Baltimore (United States of America) • - Boston (United States of America) • - Brisbane (Australia) • - Chicago (United States of America) • - Columbus (United States of America) • - Dallas (United States of America) • - Denver (United States of America) • - Detroit (United States of America) • - El Paso (United States of America) • - Fort Worth (United States of America) • - Houston (United States of America) • - Indianapolis (United States of America) • - Jacksonville (United States of America) • - Las Vegas (United States of America) • - Los Angeles (United States of America) • - Louisville (United States of America) • - Melbourne (Australia) • - Memphis (United States of America) • - Milwaukee (United States of America) • - Nashville (United States of America) • - New York City (United States of America) • - Oklahoma City (United States of America) • - Perth (Australia) • - Philadelphia (United States of America) • - Phoenix (United States of America) • - Portland (United States of America) • - San Antonio (United States of America) • - San Diego (United States of America) • - San Francisco (United States of America) • - San Jose (United States of America) • - Seattle (United States of America) • - Sydney (Australia) • - Tucson (United States of America) • - Washington, D.C. (United States of America) -
-
-

South America

- Arequipa (Peru) • - Asunción (Paraguay) • - Barquisimeto (Venezuela) • - Belo Horizonte (Brazil) • - Belém (Brazil) • - Bogota (Colombia) • - Brasília (Brazil) • - Buenos Aires (Argentina) • - Cali (Colombia) • - Callao (Peru) • - Campinas (Brazil) • - Chiclayo (Peru) • - Curitiba (Brazil) • - Cúcuta (Venezuela) • - Fortaleza (Brazil) • - Goiânia (Brazil) • - Guarulhos (Brazil) • - Guayaquil (Ecuador) • - La Paz (Bolivia) • - La Plata (Argentina) • - Lima (Peru) • - Maceió (Brazil) • - Manaus (Brazil) • - Mar del Plata (Argentina) • - Maracay (Venezuela) • - Montevideo (Uruguay) • - Osasco (Brazil) • - Panama City (Panama) • - Porto Alegre (Brazil) • - Quito (Ecuador) • - Recife (Brazil) • - Ribeirão Preto (Brazil) • - Rio de Janeiro (Brazil) • - Rosario (Argentina) • - San Miguel de Tucumán (Argentina) • - Santa Cruz (Bolivia) • - Santiago (Chile) • - Santo André (Brazil) • - Sorocaba (Brazil) • - São Bernardo do Campo (Brazil) • - São José dos Campos (Brazil) • - São Luís (Brazil) • - São Paulo (Brazil) • - Trujillo (Peru) • - Uberlândia (Brazil) • - Yurimaguas (Peru) -
From 8ca402ed17eb21fcc1ba688e9b9cceca387ff9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Fri, 24 Mar 2017 20:02:41 +0100 Subject: [PATCH 23/47] style(monument): code clean-up --- src/components/main/monument/components/location.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/main/monument/components/location.js b/src/components/main/monument/components/location.js index 49f1dd7..59802e7 100644 --- a/src/components/main/monument/components/location.js +++ b/src/components/main/monument/components/location.js @@ -19,14 +19,15 @@ function controller(wikidata) { function init() { let prop; let id; + const claims = vm.monument.claims; - if (vm.monument.claims.P276) { + if (claims.P276) { prop = 'wdt:P276/wdt:P131'; id = vm.monument.id; - } else if (vm.monument.claims.P131) { + } else if (claims.P131) { prop = 'wdt:P131'; - const preferred = vm.monument.claims.P131.values.filter(value => value.rank === 'preferred'); - id = preferred.length ? preferred[0].value_id : vm.monument.claims.P131.values[0].value_id; + const preferred = claims.P131.values.filter(value => value.rank === 'preferred'); + id = preferred.length ? preferred[0].value_id : claims.P131.values[0].value_id; } else { return; } From 3ab7a30102cbbc40f2405ad96871d90026668ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Fri, 24 Mar 2017 20:03:12 +0100 Subject: [PATCH 24/47] feat(games): init games --- src/components/index.js | 4 + .../main/games/category/games-category.html | 35 +++++++ .../main/games/category/games-category.js | 97 +++++++++++++++++++ src/components/main/games/games.scss | 40 ++++++++ src/index.js | 10 ++ src/services/wiki.service.js | 13 +++ 6 files changed, 199 insertions(+) create mode 100644 src/components/main/games/category/games-category.html create mode 100644 src/components/main/games/category/games-category.js create mode 100644 src/components/main/games/games.scss diff --git a/src/components/index.js b/src/components/index.js index 9c7ca63..e5aa0c7 100755 --- a/src/components/index.js +++ b/src/components/index.js @@ -9,6 +9,8 @@ import url from './main/monument/components/url'; import toolbar from './toolbar/toolbar'; +import category from './main/games/category/games-category'; + export default () => { main(); dashboard(); @@ -20,4 +22,6 @@ export default () => { url(); toolbar(); + + category(); }; diff --git a/src/components/main/games/category/games-category.html b/src/components/main/games/category/games-category.html new file mode 100644 index 0000000..5b64062 --- /dev/null +++ b/src/components/main/games/category/games-category.html @@ -0,0 +1,35 @@ +
+ +
+
+
Loading...
+ + +
+ Adding category "{{ item.loading }}"... +
+
+ {{ item.name.value }} +
+
+

+ {{ item.name.value }}
+ {{ item.name.value_id }} +

+ +
+
+
+
+
+
+
\ No newline at end of file diff --git a/src/components/main/games/category/games-category.js b/src/components/main/games/category/games-category.js new file mode 100644 index 0000000..f1d5261 --- /dev/null +++ b/src/components/main/games/category/games-category.js @@ -0,0 +1,97 @@ +import _ from 'lodash'; + +import './../games.scss'; +import template from './games-category.html'; + +const GamesCategoryComponent = { controller, template }; + +function controller($state, $window, WikiService, wikidata) { + const vm = this; + vm.loading = true; + + vm.hideItem = hideItem; + vm.saveCategory = saveCategory; + + init(); + + function getCategories(filenames) { + return WikiService.getFilesCategories(filenames.map(filename => `File:${filename}`)) + .then((response) => { + const images = {}; + _.values(response).forEach((element) => { + images[element.title.substring(5)] = element.categories ? + element.categories.map(category => category.title.substring(9)) : + false; + }); + return images; + }); + } + + function getList() { + return wikidata.getSPARQL(`SELECT ?item ?itemLabel (SAMPLE(?image) AS ?image) + WHERE { + ?item wdt:P17 wd:Q36 . + ?item wdt:P1435 ?monument . + ?item wdt:P18 ?image . + MINUS { ?item wdt:P373 ?commons } . + SERVICE wikibase:label { bd:serviceParam wikibase:language "pl" } + } + GROUP BY ?item ?itemLabel`); + } + + function hideItem(item) { + vm.list = vm.list.filter(element => element.name.value_id !== item.name.value_id); + if (!vm.list.length) { init(); } + } + + function init() { + vm.loading = true; + getList().then((data) => { + console.log(data.length); + const rand = Math.floor(Math.random() * (data.length - 24)); + console.log(rand); + data = data.slice(rand, rand + 25); + vm.list = data.map(element => ({ + name: { + value_id: element.item.value.substring(element.item.value.indexOf('/Q') + 1), + value: element.itemLabel.value, + }, + filename: decodeURIComponent(element.image.value.replace('http://commons.wikimedia.org/wiki/Special:FilePath/', '')), + image: element.image ? `${element.image.value.replace('wiki/Special:FilePath', 'w/index.php?title=Special:Redirect/file')}&width=120` : false, + })); + return vm.list; + }) + .then(list => getCategories(list.map(entry => entry.filename))) + .then((response) => { + vm.list.forEach((element) => { + element.categories = response[element.filename]; + }); + vm.loading = false; + }); + } + + function saveCategory(item, category) { + if (item.name.value_id && category) { + item.loading = category; + WikiService.setClaim({ + action: 'wbcreateclaim', + format: 'json', + entity: `${item.name.value_id}`, + property: 'P373', + snaktype: 'value', + summary: '#monumental', + value: `"${category}"`, + }).then((response) => { + hideItem(item); + }).catch((err) => { + item.loading = false; + }); + } + } +} + +export default () => { + angular + .module('monumental') + .component('moGameCategory', GamesCategoryComponent); +}; diff --git a/src/components/main/games/games.scss b/src/components/main/games/games.scss new file mode 100644 index 0000000..bdc34e8 --- /dev/null +++ b/src/components/main/games/games.scss @@ -0,0 +1,40 @@ +@import '../../../styles/variables'; +@import '../../../styles/responsive'; + +mo-game-category { + .list { + width: 980px; + } + + .list__container { + margin-right: 20px; + background: white; + border: 1px solid $softGrey; + border-radius: 2px; + + md-list-item.md-2-line { + border-bottom: 1px solid $softGrey; + } + } + + .list__image { + width: 75px; + min-width: 75px; + height: 75px; + background: $softGrey; + margin: 15px 15px 15px 0; + + img { + max-width: 100%; + max-height: 100%; + } + } + + .list__loading { + position: absolute; + width: 100%; + height: 100%; + background: rgba(255, 255, 255, .9); + z-index: 10; + } +} diff --git a/src/index.js b/src/index.js index 7077f59..3777480 100755 --- a/src/index.js +++ b/src/index.js @@ -82,6 +82,16 @@ function stateConfig($stateProvider, $urlRouterProvider) { url: '/object/:id?lang', template: '', resolve: {}, + }) + .state('main.game', { + abstract: true, + url: '/game', + template: '

Loading

', + }) + .state('main.game.category', { + url: '/category', + template: '', + resolve: {}, }); $urlRouterProvider.otherwise('/'); } diff --git a/src/services/wiki.service.js b/src/services/wiki.service.js index 15eca53..c9a3513 100755 --- a/src/services/wiki.service.js +++ b/src/services/wiki.service.js @@ -3,6 +3,7 @@ import _ from 'lodash'; const WikiService = function ($http, $httpParamSerializerJQLike) { const service = { getArticleHeader, + getFilesCategories, getCategoryMembers, getImage, getUserInfo, @@ -59,6 +60,18 @@ const WikiService = function ($http, $httpParamSerializerJQLike) { }); } + function getFilesCategories(files) { + const params = angular.extend({}, defaultParams, { + prop: 'categories', + clshow: '!hidden', + cllimit: '100', + titles: files.join('|'), + }); + return $http.jsonp('https://commons.wikimedia.org/w/api.php', { + params, + }).then(response => response.data.query.pages); + } + function getImage(image, extraParams) { const params = angular.extend({}, imageParams, { titles: `File:${image}` }, extraParams); return $http.jsonp('https://commons.wikimedia.org/w/api.php', { From 80f607772ae1d873475a2632204b49421378cfc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Fri, 24 Mar 2017 23:32:16 +0100 Subject: [PATCH 25/47] fix(url): remove trailing slash --- src/components/main/monument/components/url.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/main/monument/components/url.js b/src/components/main/monument/components/url.js index a077934..e5ff926 100644 --- a/src/components/main/monument/components/url.js +++ b/src/components/main/monument/components/url.js @@ -16,7 +16,7 @@ function controller() { if (vm.monument && vm.monument.claims && vm.monument.claims.P856) { const values = vm.monument.claims.P856.values; vm.value = values[0].value; - vm.label = values[0].value.replace(/^https?:\/\/(www\.)?/, ''); + vm.label = values[0].value.replace(/^https?:\/\/(www\.)?/, '').replace(/^\/|\/$/g, ''); } } } From 346f4b85299830c94526fc8c74e86a0180f17692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sat, 25 Mar 2017 00:59:30 +0100 Subject: [PATCH 26/47] feat(services): add lang service --- src/services/index.js | 2 + src/services/lang.service.js | 211 +++++++++++++++++++++++++++++++++++ 2 files changed, 213 insertions(+) create mode 100644 src/services/lang.service.js diff --git a/src/services/index.js b/src/services/index.js index 3d53019..a1987f2 100755 --- a/src/services/index.js +++ b/src/services/index.js @@ -1,9 +1,11 @@ +import lang from './lang.service'; import map from './map.service'; import theme from './theme.service'; import wiki from './wiki.service'; import wikidata from './wikidata.service'; export default () => { + lang(); map(); theme(); wiki(); diff --git a/src/services/lang.service.js b/src/services/lang.service.js new file mode 100644 index 0000000..3e3bc8e --- /dev/null +++ b/src/services/lang.service.js @@ -0,0 +1,211 @@ +const LangService = function () { + const service = { + getNativeLanguages, + }; + + const languagesList = { + Q889: ['ps'], + Q222: ['sq'], + Q262: ['ar'], + Q228: ['ca'], + Q916: ['pt'], + Q781: ['en'], + Q414: ['es'], + Q399: ['hy'], + Q408: ['en'], + Q40: ['de'], + Q227: ['az'], + Q398: ['ar'], + Q902: ['bn'], + Q244: ['en'], + Q184: ['ru', 'be'], + Q31: ['fr', 'de', 'nl'], + Q242: ['en'], + Q962: ['fr'], + Q917: ['dz'], + Q750: ['es'], + Q225: ['hr', 'sr', 'bs'], + Q963: ['en'], + Q155: ['pt'], + Q921: ['en'], + Q219: ['bg'], + Q965: ['fr'], + Q967: ['fr', 'en'], + Q424: ['km'], + Q1009: ['fr', 'en'], + Q1011: ['pt'], + Q929: ['fr'], + Q657: ['fr', 'ar'], + Q298: ['es'], + Q739: ['es'], + Q970: ['fr', 'ar'], + Q800: ['es'], + Q224: ['hr'], + Q241: ['es'], + Q229: ['tr', 'el'], + Q213: ['cs'], + Q1008: ['fr'], + Q974: ['fr'], + Q977: ['fr', 'ar'], + Q784: ['en'], + Q786: ['es'], + Q574: ['pt'], + Q736: ['es'], + Q79: ['ar'], + Q792: ['es'], + Q983: ['fr', 'es', 'pt'], + Q986: ['en', 'ar', 'ti'], + Q191: ['et'], + Q115: ['am'], + Q702: ['en'], + Q712: ['en'], + Q33: ['fi', 'sv'], + Q142: ['fr'], + Q1000: ['fr'], + Q1005: ['en'], + Q230: ['ka'], + Q183: ['de'], + Q117: ['en'], + Q41: ['el'], + Q769: ['en'], + Q774: ['es'], + Q1006: ['fr'], + Q1007: ['pt'], + Q734: ['en'], + Q790: ['fr', 'ht'], + Q783: ['es'], + Q28: ['hu'], + Q189: ['is'], + Q668: ['hi', 'en'], + Q252: ['id'], + Q794: ['fa'], + Q796: ['ar', 'ku'], + Q27: ['en'], + Q801: ['he'], + Q38: ['it'], + Q766: ['en'], + Q17: ['ja'], + Q810: ['ar'], + Q232: ['kk'], + Q114: ['en', 'sw'], + Q29999: ['nl'], + Q710: ['en'], + Q817: ['ar'], + Q813: ['ru', 'ky'], + Q819: ['lo'], + Q211: ['lv'], + Q822: ['ar'], + Q1013: ['en', 'st'], + Q1014: ['en'], + Q1016: ['ar'], + Q347: ['de'], + Q37: ['lt'], + Q32: ['fr', 'de', 'lb'], + Q1019: ['fr', 'mg'], + Q1020: ['en', 'ny'], + Q833: ['en'], + Q826: ['dv'], + Q912: ['fr'], + Q233: ['en', 'mt'], + Q709: ['en', 'mh'], + Q1025: ['ar'], + Q1027: ['fr', 'en'], + Q96: ['es'], + Q217: ['mo'], + Q235: ['fr'], + Q711: ['mn'], + Q236: ['hr', 'sq', 'sr', 'bs'], + Q1028: ['ar'], + Q1029: ['pt'], + Q836: ['my'], + Q1030: ['en'], + Q697: ['en', 'na'], + Q837: ['ne'], + Q664: ['en', 'mi'], + Q811: ['es'], + Q1032: ['fr'], + Q1033: ['en'], + Q423: ['ko'], + Q20: ['nn', 'nb'], + Q842: ['ar'], + Q843: ['ur', 'en'], + Q695: ['en'], + Q804: ['es'], + Q691: ['en', 'ho', 'tpi'], + Q733: ['es', 'gn'], + Q419: ['es', 'ay'], + Q928: ['en'], + Q36: ['pl'], + Q45: ['pt'], + Q846: ['ar'], + Q221: ['mk'], + Q971: ['fr'], + Q218: ['ro'], + Q159: ['ru'], + Q1037: ['fr', 'en', 'rw'], + Q763: ['en'], + Q760: ['en'], + Q757: ['es', 'en'], + Q683: ['en', 'sm'], + Q238: ['it'], + Q1039: ['pt'], + Q1041: ['fr'], + Q403: ['sr'], + Q1042: ['fr', 'en', 'crs'], + Q1044: ['en'], + Q334: ['en', 'ta', 'ms'], + Q214: ['sk'], + Q215: ['sl'], + Q685: ['en'], + Q1045: ['so', 'ar'], + Q258: ['en', 'zu'], + Q884: ['ko'], + Q958: ['en'], + Q29: ['es'], + Q854: ['ta', 'si'], + Q1049: ['en', 'ar'], + Q730: ['nl'], + Q1050: ['en', 'ss'], + Q34: ['fi', 'yi', 'sv'], + Q39: ['fr', 'de', 'it'], + Q858: ['ar'], + Q863: ['tg'], + Q924: ['en', 'sw'], + Q869: ['th'], + Q778: ['en'], + Q945: ['fr'], + Q678: ['en', 'to'], + Q754: ['en'], + Q948: ['ar'], + Q43: ['tr'], + Q874: ['ru', 'tk'], + Q672: ['en', 'tvl'], + Q1036: ['en', 'sw'], + Q212: ['uk'], + Q878: ['ar'], + Q145: ['en'], + Q30: ['en'], + Q77: ['es'], + Q265: ['uz'], + Q686: ['fr', 'en', 'bi'], + Q717: ['es'], + Q881: ['vi'], + Q805: ['ar'], + Q953: ['en'], + Q954: ['en'], + }; + + return service; + + // + + function getNativeLanguages(code) { + return languagesList[code]; + } +}; + +export default () => { + angular + .module('monumental') + .factory('langService', LangService); +}; From fa15fa6659a7cc6e3596cbfb122acc9d358cf019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sat, 25 Mar 2017 01:11:03 +0100 Subject: [PATCH 27/47] refactor(monument): code clean-up, add commons category info --- src/components/main/monument/monument.html | 16 +++-- src/components/main/monument/monument.js | 68 ++++++++++------------ src/services/wiki.service.js | 15 +++++ 3 files changed, 56 insertions(+), 43 deletions(-) diff --git a/src/components/main/monument/monument.html b/src/components/main/monument/monument.html index 91e4d29..ad16786 100755 --- a/src/components/main/monument/monument.html +++ b/src/components/main/monument/monument.html @@ -24,17 +24,23 @@

{{ ::$ctrl.monument.labels.en |
-
+
photo - {{ $ctrl.images.length || 0 }} images + + + {{ $ctrl.category.files }} images + and {{ $ctrl.category.subcats }} subcategories + + no Commons category +
-
+
description {{ $ctrl.monument.interwikis || 0 }} wikis
-
+
account_balance
@@ -43,7 +49,7 @@

{{ ::$ctrl.monument.labels.en |

- +
diff --git a/src/components/main/monument/monument.js b/src/components/main/monument/monument.js index 8ecfe62..9eb0657 100755 --- a/src/components/main/monument/monument.js +++ b/src/components/main/monument/monument.js @@ -6,26 +6,15 @@ import '../../../images/marker.png'; const MonumentComponent = { controller, template }; -function controller($http, $q, $sce, $stateParams, $timeout, $window, localStorageService, WikiService, wikidata) { +function controller($http, $q, $sce, $stateParams, $timeout, $window, localStorageService, WikiService, langService, mapService, wikidata) { const vm = this; + const icon = mapService.getMapIcon(); const id = $stateParams.id.includes('Q') ? $stateParams.id : `Q${$stateParams.id}`; vm.getCommonsLink = getCommonsLink; vm.image = []; vm.map = {}; - vm.addCategory = function () { - WikiService.setClaim({ - action: 'wbcreateclaim', - format: 'json', - entity: `${id}`, - property: 'P373', - snaktype: 'value', - summary: '#monumental', - value: '"Mikołów town hall"', - }); - }; - let langs = $stateParams.lang ? [$stateParams.lang] : []; langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); @@ -35,6 +24,12 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora // functions + function getCategoryInfo(category) { + WikiService.getCategoryInfo(category).then((response) => { + vm.category = response; + }); + } + function getCategoryMembers(category) { WikiService.getCategoryMembers(category).then((data) => { const promises = data.map(image => WikiService.getImage(image, { iiurlheight: 75 })); @@ -60,8 +55,11 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora return `https://commons.wikimedia.org/wiki/Category:${encodeURIComponent(name)}`; } - function getImage(image) { - WikiService.getImage(image).then((response) => { + function getImage() { + const image = getPropertyValue('P18'); + if (!image) { return; } + + WikiService.getImage(image.value).then((response) => { vm.image.push(response.imageinfo); }); } @@ -75,6 +73,13 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora })); } + function getPropertyValue(prop) { + if (vm.monument.claims[prop] && vm.monument.claims[prop].values.length) { + return vm.monument.claims[prop].values[0]; + } + return false; + } + function getWikidata() { vm.loading = true; wikidata.getById(id).then((data) => { @@ -82,11 +87,9 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora vm.monument = data[first]; const claims = vm.monument.claims; - if (vm.monument.claims.P18) { - getImage(claims.P18.values[0].value); - // claims.P18.values.forEach(image => getImage(image.value)); - } + getImage(); if (vm.monument.claims.P373) { + getCategoryInfo(claims.P373.values[0].value); getCategoryMembers(claims.P373.values[0].value); } @@ -97,27 +100,16 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora } if (vm.monument.claims.P625) { const value = vm.monument.claims.P625.values[0].value; - const icon = { - iconUrl: 'assets/images/marker.png', - shadowUrl: undefined, - iconSize: [40, 40], - shadowSize: [0, 0], - iconAnchor: [20, 20], - shadowAnchor: [0, 0], - }; - - vm.map = { - center: { + vm.map = mapService.getMapInstance({ center: { + lat: value.latitude, + lng: value.longitude, + zoom: 15, + } }); + vm.map.markers = { + marker: { lat: value.latitude, lng: value.longitude, - zoom: 15, - }, - markers: { - marker: { - lat: value.latitude, - lng: value.longitude, - icon, - }, + icon, }, }; } diff --git a/src/services/wiki.service.js b/src/services/wiki.service.js index c9a3513..617f157 100755 --- a/src/services/wiki.service.js +++ b/src/services/wiki.service.js @@ -4,6 +4,7 @@ const WikiService = function ($http, $httpParamSerializerJQLike) { const service = { getArticleHeader, getFilesCategories, + getCategoryInfo, getCategoryMembers, getImage, getUserInfo, @@ -49,6 +50,20 @@ const WikiService = function ($http, $httpParamSerializerJQLike) { }); } + function getCategoryInfo(category) { + const params = angular.extend({}, defaultParams, { + prop: 'categoryinfo', + titles: `Category:${category}`, + }); + return $http.jsonp('https://commons.wikimedia.org/w/api.php', { + params, + cache: true, + }).then((response) => { + const page = _.sample(response.data.query.pages); + return angular.extend({}, page.categoryinfo, { title: page.title }); + }); + } + function getCategoryMembers(category) { const params = angular.extend({}, categoryFilesParams, { cmtitle: `Category:${category}` }); return $http.jsonp('https://commons.wikimedia.org/w/api.php', { From 42654e92e35402efe71bc40630090f0b5ad155c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sat, 25 Mar 2017 01:12:25 +0100 Subject: [PATCH 28/47] feat(monument): add native-name component --- src/components/index.js | 2 ++ src/components/main/list/list.html | 2 +- .../main/monument/components/native-name.js | 29 +++++++++++++++++++ src/components/main/monument/monument.html | 4 ++- src/services/wikidata.service.js | 26 ++++++++--------- 5 files changed, 48 insertions(+), 15 deletions(-) create mode 100644 src/components/main/monument/components/native-name.js diff --git a/src/components/index.js b/src/components/index.js index e5aa0c7..d8b0a50 100755 --- a/src/components/index.js +++ b/src/components/index.js @@ -5,6 +5,7 @@ import map from './main/map/map'; import monument from './main/monument/monument'; import location from './main/monument/components/location'; +import nativeName from './main/monument/components/native-name'; import url from './main/monument/components/url'; import toolbar from './toolbar/toolbar'; @@ -19,6 +20,7 @@ export default () => { monument(); location(); + nativeName(); url(); toolbar(); diff --git a/src/components/main/list/list.html b/src/components/main/list/list.html index 87d18ed..4a3aa04 100755 --- a/src/components/main/list/list.html +++ b/src/components/main/list/list.html @@ -20,7 +20,7 @@

{{ ::$ctrl.place.labels[$ctrl.lang] || "no name" }}

-

{{ ::$ctrl.place.labels.en }}

+

Wikidata diff --git a/src/components/main/monument/components/native-name.js b/src/components/main/monument/components/native-name.js new file mode 100644 index 0000000..39ebea9 --- /dev/null +++ b/src/components/main/monument/components/native-name.js @@ -0,0 +1,29 @@ +const NativeNameComponent = { + bindings: { monument: '=' }, + controller, + template: '{{ ::name }} · ', +}; + +function controller(langService) { + const vm = this; + vm.getNativeLabel = getNativeLabel; + + function getNativeLabel() { + const country = getPropertyValue('P17'); + const languages = langService.getNativeLanguages(country.value_id); + return languages.map(lang => vm.monument.labels[lang]).filter(name => name); + } + + function getPropertyValue(prop) { + if (vm.monument.claims[prop] && vm.monument.claims[prop].values.length) { + return vm.monument.claims[prop].values[0]; + } + return false; + } +} + +export default () => { + angular + .module('monumental') + .component('moNativeName', NativeNameComponent); +}; diff --git a/src/components/main/monument/monument.html b/src/components/main/monument/monument.html index ad16786..667fec3 100755 --- a/src/components/main/monument/monument.html +++ b/src/components/main/monument/monument.html @@ -15,7 +15,9 @@

{{ ::$ctrl.monument.labels[$ctrl.lang] || "no name" }}

-

{{ ::$ctrl.monument.labels.en || "no english name" }}

+

+ +

Wikidata diff --git a/src/services/wikidata.service.js b/src/services/wikidata.service.js index cf09a10..d50cda3 100755 --- a/src/services/wikidata.service.js +++ b/src/services/wikidata.service.js @@ -1,6 +1,6 @@ -const wdService = function ($http, $q) { - +const wdService = function ($http) { const service = { + get, getById, getLabels, getRecursive, @@ -41,18 +41,18 @@ const wdService = function ($http, $q) { * @returns {Promise} */ function get(data) { - let params = angular.extend({}, defaultParams, data); + const params = angular.extend({}, defaultParams, data); return $http.jsonp('https://www.wikidata.org/w/api.php', { params: mapValues(params, p => angular.isArray(p) ? p.join('|') : p), - cache: false - }); + cache: false, + }).then(response => response.data); } function getLabels(ids) { return get({ - ids: ids, - props: ['labels'] - }).then(response => mapValues(response.data.entities, entity => simplifyLabels(entity.labels))); + ids, + props: ['labels'], + }).then(response => mapValues(response.entities, entity => simplifyLabels(entity.labels))); } function getRecursive(element, recursiveProperty) { @@ -74,8 +74,8 @@ const wdService = function ($http, $q) { action: 'wbsearchentities', search: text, type: 'item', - language: defaultParams.languages[0] - }).then(data => data.data.search); + language: defaultParams.languages[0], + }).then(response => response.search); } function getSPARQL(query) { @@ -149,10 +149,10 @@ const wdService = function ($http, $q) { return get({ ids: id, - languages: defaultParams.languages, + languages: undefined, }) - .then(data => mapValues(data.data.entities, entity => simplifyEntity(entity))) - .then(data => { + .then(response => mapValues(response.entities, entity => simplifyEntity(entity))) + .then((data) => { entities = data; const simplified = mapValues(data, entity => mapValues(entity.claims, From 891909b6989bcb31f8ad9dfed6143c699462844b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sat, 25 Mar 2017 23:32:40 +0100 Subject: [PATCH 29/47] feat(dashboard): visual clean-up --- src/components/main/dashboard/dashboard.html | 302 ++++++++++--------- src/components/main/dashboard/dashboard.scss | 20 ++ 2 files changed, 173 insertions(+), 149 deletions(-) diff --git a/src/components/main/dashboard/dashboard.html b/src/components/main/dashboard/dashboard.html index 08e09fc..202082a 100755 --- a/src/components/main/dashboard/dashboard.html +++ b/src/components/main/dashboard/dashboard.html @@ -1,156 +1,160 @@
-
-

Europe

- Adana (Turkey) • - Almaty (Kazakhstan) • - Amsterdam (Netherlands) • - Ankara (Turkey) • - Antalya (Turkey) • - Astana (Kazakhstan) • - Astrakhan (Russia) • - Athens (Greece) • - Baku (Azerbaijan) • - Balıkesir (Turkey) • - Barcelona (Spain) • - Barnaul (Russia) • - Belgrade (Serbia) • - Berlin (Germany) • - Birmingham (United Kingdom) • - Bratislava (Slovakia) • - Bremen (Germany) • - Brussels (Belgium) • - Bucharest (Romania) • - Budapest (Hungary) • - Bursa (Turkey) • - Chelyabinsk (Russia) • - Chișinău (Moldova) • - Cologne (Germany) • - Copenhagen (Denmark) • - Denizli (Turkey) • - Dnipro (Ukraine) • - Donetsk (Ukraine) • - Dortmund (Germany) • - Dresden (Germany) • - Dublin (Ireland) • - Düsseldorf (Germany) • - Essen (Germany) • - Frankfurt (Germany) • - Free Hanseatic City of Bremen (Germany) • - Ganja (Azerbaijan) • - Gaziantep (Turkey) • - Genoa (Italy) • - Glasgow (United Kingdom) • - Gomel (Belarus) • - Gothenburg (Sweden) • - Hamburg (Germany) • - Hanover (Germany) • - Helsinki (Finland) • - Istanbul (Turkey) • - Kayseri (Turkey) • - Kazan (Russia) • - Kemerovo (Russia) • - Khabarovsk (Russia) • - Kharkiv (Ukraine) • - Kraków (Poland) • - Krasnoyarsk (Russia) • - Kryvyi Rih (Ukraine) • - Kyiv (Ukraine) • - Leeds (United Kingdom) • - Leipzig (Germany) • - Lisbon (Portugal) • - London (United Kingdom) • - Lviv (Ukraine) • - Madrid (Spain) • - Makhachkala (Russia) • - Marseille (France) • - Milan (Italy) • - Minsk (Belarus) • - Moscow (Russia) • - Munich (Germany) • - Málaga (Spain) • - Naberezhnye Chelny (Russia) • - Naples (Italy) • - Nizhny Novgorod (Russia) • - Novosibirsk (Russia) • - Nuremberg (Germany) • - Omsk (Russia) • - Oslo (Norway) • - Palermo (Italy) • - Paris (France) • - Penza (Russia) • - Perm (Russia) • - Poznań (Poland) • - Prague (Czech Republic) • - Riga (Latvia) • - Rome (Italy) • - Rostov-on-Don (Russia) • - Rotterdam (Netherlands) • - Saint Petersburg (Russia) • - Samara (Russia) • - Seville (Spain) • - Sheffield (United Kingdom) • - Shymkent (Kazakhstan) • - Skopje (Republic of Macedonia) • - Sofia (Bulgaria) • - Stockholm (Sweden) • - Stuttgart (Germany) • - Tbilisi (Georgia) • - The Hague (Netherlands) • - Tolyatti (Russia) • - Turin (Italy) • - Tyumen (Russia) • - Ufa (Russia) • - Ulyanovsk (Russia) • - Valencia (Spain) • - Vienna (Austria) • - Vilnius (Lithuania) • - Vladivostok (Russia) • - Volgograd (Russia) • - Voronezh (Russia) • - Warsaw (Poland) • - Wrocław (Poland) • - Yaroslavl (Russia) • - Yekaterinburg (Russia) • - Yerevan (Armenia) • - Zagreb (Croatia) • - Zaporizhzhya (Ukraine) • - Zaragoza (Spain) • - İzmir (Turkey) • - Łódź (Poland) -
-
-
-
-

Language

-
- - - - - - - - - - - - +
+
+

Examples

+

+ Adana (Turkey) · + Almaty (Kazakhstan) · + Amsterdam (Netherlands) · + Ankara (Turkey) · + Antalya (Turkey) · + Astana (Kazakhstan) · + Astrakhan (Russia) · + Athens (Greece) · + Baku (Azerbaijan) · + Balıkesir (Turkey) · + Barcelona (Spain) · + Barnaul (Russia) · + Belgrade (Serbia) · + Berlin (Germany) · + Birmingham (United Kingdom) · + Bratislava (Slovakia) · + Bremen (Germany) · + Brussels (Belgium) · + Bucharest (Romania) · + Budapest (Hungary) · + Bursa (Turkey) · + Chelyabinsk (Russia) · + Chișinău (Moldova) · + Cologne (Germany) · + Copenhagen (Denmark) · + Denizli (Turkey) · + Dnipro (Ukraine) · + Donetsk (Ukraine) · + Dortmund (Germany) · + Dresden (Germany) · + Dublin (Ireland) · + Düsseldorf (Germany) · + Essen (Germany) · + Frankfurt (Germany) · + Bremen (Germany) · + Ganja (Azerbaijan) · + Gaziantep (Turkey) · + Genoa (Italy) · + Glasgow (United Kingdom) · + Gomel (Belarus) · + Gothenburg (Sweden) · + Hamburg (Germany) · + Hanover (Germany) · + Helsinki (Finland) · + Istanbul (Turkey) · + Kayseri (Turkey) · + Kazan (Russia) · + Kemerovo (Russia) · + Khabarovsk (Russia) · + Kharkiv (Ukraine) · + Kraków (Poland) · + Krasnoyarsk (Russia) · + Kryvyi Rih (Ukraine) · + Kyiv (Ukraine) · + Leeds (United Kingdom) · + Leipzig (Germany) · + Lisbon (Portugal) · + London (United Kingdom) · + Lviv (Ukraine) · + Madrid (Spain) · + Makhachkala (Russia) · + Marseille (France) · + Milan (Italy) · + Minsk (Belarus) · + Moscow (Russia) · + Munich (Germany) · + Málaga (Spain) · + Naberezhnye Chelny (Russia) · + Naples (Italy) · + Nizhny Novgorod (Russia) · + Novosibirsk (Russia) · + Nuremberg (Germany) · + Omsk (Russia) · + Oslo (Norway) · + Palermo (Italy) · + Paris (France) · + Penza (Russia) · + Perm (Russia) · + Poznań (Poland) · + Prague (Czech Republic) · + Riga (Latvia) · + Rome (Italy) · + Rostov-on-Don (Russia) · + Rotterdam (Netherlands) · + Saint Petersburg (Russia) · + Samara (Russia) · + Seville (Spain) · + Sheffield (United Kingdom) · + Shymkent (Kazakhstan) · + Skopje (Republic of Macedonia) · + Sofia (Bulgaria) · + Stockholm (Sweden) · + Stuttgart (Germany) · + Tbilisi (Georgia) · + The Hague (Netherlands) · + Tolyatti (Russia) · + Turin (Italy) · + Tyumen (Russia) · + Ufa (Russia) · + Ulyanovsk (Russia) · + Valencia (Spain) · + Vienna (Austria) · + Vilnius (Lithuania) · + Vladivostok (Russia) · + Volgograd (Russia) · + Voronezh (Russia) · + Warsaw (Poland) · + Wrocław (Poland) · + Yaroslavl (Russia) · + Yekaterinburg (Russia) · + Yerevan (Armenia) · + Zagreb (Croatia) · + Zaporizhzhya (Ukraine) · + Zaragoza (Spain) · + İzmir (Turkey) · + Łódź (Poland) +

+
+
+ +
+

Set language

+

+ + + + + + + + + + + + +

+ Save +
- Save -
-
diff --git a/src/components/main/dashboard/dashboard.scss b/src/components/main/dashboard/dashboard.scss index 602dda5..d8947a2 100755 --- a/src/components/main/dashboard/dashboard.scss +++ b/src/components/main/dashboard/dashboard.scss @@ -6,4 +6,24 @@ mo-dashboard { width: 980px; max-width: 100%; } + + .dashboard__box { + margin: 5px; + background: white; + border: 1px solid $softGrey; + border-radius: 2px; + padding: 20px; + + .md-title { + margin: 0; + } + + md-input-container { + margin-bottom: 0; + + .md-errors-spacer { + display: none; + } + } + } } \ No newline at end of file From 2a6ab3900e68d69fbaf5c7548e3ddd3a132f7b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sat, 25 Mar 2017 23:34:23 +0100 Subject: [PATCH 30/47] feat(games): logic and visual improvements for category game --- .../main/games/category/games-category.html | 101 ++++++++++++---- .../main/games/category/games-category.js | 110 +++++++++++------- src/components/main/games/games.scss | 87 +++++++++++++- src/index.js | 4 +- src/services/wiki.service.js | 30 ++++- 5 files changed, 262 insertions(+), 70 deletions(-) diff --git a/src/components/main/games/category/games-category.html b/src/components/main/games/category/games-category.html index 5b64062..8834879 100644 --- a/src/components/main/games/category/games-category.html +++ b/src/components/main/games/category/games-category.html @@ -1,35 +1,94 @@
+
+
+
+
+ + List of monuments in + + + {{ ::country.name }} + + + with image but without Wikimedia Commons category. + + Click plus next to category sugestion to add it. +
+
+ + This is cached value. It means it is not updated real-time. + {{$ctrl.total}} results + + + forward next entries + +
+
+
-
+
-
Loading...
- - -
- Adding category "{{ item.loading }}"... -
-
- {{ item.name.value }} -
+ +
-

- {{ item.name.value }}
- {{ item.name.value_id }} +

+ + {{ ::item.name.value }} + +
+

+ {{ ::item.name.value }} + {{ ::item.place }} · {{ ::item.admin }}

-

- (ADD) - {{ category }} +

+ + add_circle_outline + + check_circle + + + Click to see diff or revert edit + check_circle + + + {{ ::category }} +

-

NONE ABOVE / NOT SURE

-
+
+
+ + forward next entries + +
+
+

{{ $ctrl.error }}

+
+
+

Loading data...

+
\ No newline at end of file diff --git a/src/components/main/games/category/games-category.js b/src/components/main/games/category/games-category.js index f1d5261..79c9520 100644 --- a/src/components/main/games/category/games-category.js +++ b/src/components/main/games/category/games-category.js @@ -5,11 +5,21 @@ import template from './games-category.html'; const GamesCategoryComponent = { controller, template }; -function controller($state, $window, WikiService, wikidata) { +function controller($q, $state, $stateParams, $window, WikiService, langService, wikidata) { const vm = this; + const id = $stateParams.country.includes('Q') ? $stateParams.country : `Q${$stateParams.country}`; + + vm.countries = [ + { name: 'France', code: 'Q142' }, + { name: 'Germany', code: 'Q183' }, + { name: 'Great Britain', code: 'Q145' }, + { name: 'Poland', code: 'Q36' }, + { name: 'the United States', code: 'Q30' }, + ]; + vm.country = id || 'Q36'; vm.loading = true; - vm.hideItem = hideItem; + vm.reload = () => $state.go($state.current, { country: vm.country }, { reload: true }); vm.saveCategory = saveCategory; init(); @@ -27,63 +37,79 @@ function controller($state, $window, WikiService, wikidata) { }); } + function getCountry() { + wikidata.get({ ids: id }) + .then((response) => { + const entry = response.entities[id]; + vm.name = entry.labels.en.value; + }); + } + function getList() { - return wikidata.getSPARQL(`SELECT ?item ?itemLabel (SAMPLE(?image) AS ?image) + const langs = langService.getNativeLanguages(id); + if (!langs) { return $q.reject('Provided ID is not a country'); } + + return wikidata.getSPARQL(`SELECT ?item ?itemLabel (SAMPLE(?placeLabel) AS ?placeLabel) (SAMPLE(?adminLabel) AS ?adminLabel) (SAMPLE(?image) AS ?image) WHERE { - ?item wdt:P17 wd:Q36 . + ?item wdt:P17 wd:${id} . ?item wdt:P1435 ?monument . ?item wdt:P18 ?image . + OPTIONAL { ?item wdt:P276 ?place . ?place rdfs:label ?placeLabel . FILTER(LANG(?placeLabel) = "${langs[0]}") } . + OPTIONAL { ?item wdt:P131 ?admin . ?admin rdfs:label ?adminLabel . FILTER(LANG(?adminLabel) = "${langs[0]}") } . MINUS { ?item wdt:P373 ?commons } . - SERVICE wikibase:label { bd:serviceParam wikibase:language "pl" } + SERVICE wikibase:label { bd:serviceParam wikibase:language "${langs.join(',')}" } } GROUP BY ?item ?itemLabel`); } - function hideItem(item) { - vm.list = vm.list.filter(element => element.name.value_id !== item.name.value_id); - if (!vm.list.length) { init(); } - } - function init() { vm.loading = true; - getList().then((data) => { - console.log(data.length); - const rand = Math.floor(Math.random() * (data.length - 24)); - console.log(rand); - data = data.slice(rand, rand + 25); - vm.list = data.map(element => ({ - name: { - value_id: element.item.value.substring(element.item.value.indexOf('/Q') + 1), - value: element.itemLabel.value, - }, - filename: decodeURIComponent(element.image.value.replace('http://commons.wikimedia.org/wiki/Special:FilePath/', '')), - image: element.image ? `${element.image.value.replace('wiki/Special:FilePath', 'w/index.php?title=Special:Redirect/file')}&width=120` : false, - })); - return vm.list; - }) - .then(list => getCategories(list.map(entry => entry.filename))) - .then((response) => { - vm.list.forEach((element) => { - element.categories = response[element.filename]; + vm.list = []; + + getCountry(); + getList() + .then((response) => { + const rand = Math.floor(Math.random() * (response.length - 24)); + const data = response.slice(rand, rand + 25); + vm.total = response.length; + vm.list = data.map(element => ({ + name: { + value_id: element.item.value.substring(element.item.value.indexOf('/Q') + 1), + value: element.itemLabel.value, + }, + admin: element.adminLabel ? element.adminLabel.value : undefined, + place: element.placeLabel ? element.placeLabel.value : undefined, + image: { + name: decodeURIComponent(element.image.value.replace('http://commons.wikimedia.org/wiki/Special:FilePath/', '')), + thumburl: `${element.image.value.replace('wiki/Special:FilePath', 'w/index.php?title=Special:Redirect/file')}&width=100`, + }, + })); + if (!vm.list.length) { return $q.reject('No entries to display'); } + return vm.list; + }) + .then(list => getCategories(list.map(entry => entry.image.name))) + .then((response) => { + vm.list.forEach((element) => { + element.categories = response[element.image.name]; + }); + vm.loading = false; + }) + .catch((err) => { + vm.error = err; + vm.loading = false; }); - vm.loading = false; - }); } function saveCategory(item, category) { - if (item.name.value_id && category) { + const id = item.name.value_id; + if (id && category) { + item.success = item.error = undefined; item.loading = category; - WikiService.setClaim({ - action: 'wbcreateclaim', - format: 'json', - entity: `${item.name.value_id}`, - property: 'P373', - snaktype: 'value', - summary: '#monumental', - value: `"${category}"`, - }).then((response) => { - hideItem(item); + WikiService.addCategory(id, category).then((response) => { + item.success = category; + item.loading = false; }).catch((err) => { + item.error = err; item.loading = false; }); } diff --git a/src/components/main/games/games.scss b/src/components/main/games/games.scss index bdc34e8..9b26ee3 100644 --- a/src/components/main/games/games.scss +++ b/src/components/main/games/games.scss @@ -2,28 +2,109 @@ @import '../../../styles/responsive'; mo-game-category { + .game__subheader { + padding: 15px 25px; + background: #fafafa; + border-bottom: 1px solid $softGrey; + + md-input-container { + margin-bottom: 0; + margin-top: 0; + padding: 0 5px 2px; + + .md-errors-spacer { + display: none; + } + } + + .material-icons { + cursor: pointer; + font-size: 20px; + } + } + .list { width: 980px; } + .list__item { + border-left: 10px solid white; + + &.list__item--loading { + border-left: 10px solid #bdc3c7; + } + + &.list__item--done { + border-left: 10px solid #27ae60; + } + + &.list__item--error { + border-left: 10px solid #c0392b; + } + } + + .list__done { + background: #fafafa; + } + .list__container { - margin-right: 20px; background: white; border: 1px solid $softGrey; border-radius: 2px; + & > md-list { + padding: 0; + } + md-list-item.md-2-line { border-bottom: 1px solid $softGrey; + + .md-list-item-text { + border-right: 5px solid transparent; + + p { + color: $darkGrey; + padding: 5px 20px 5px 0; + + } + + .md-button { + min-width: 36px; + min-height: 36px; + margin: 0 10px 0 0; + } + } + } + } + + .list__category { + margin-bottom: 5px !important; + margin-right: 15px !important; + + &.list__category--underlined { + border-bottom: 1px solid $softGrey; } } + .list__status { + height: 75px; + width: 24px; + margin: 15px; + } + .list__image { width: 75px; min-width: 75px; height: 75px; background: $softGrey; - margin: 15px 15px 15px 0; - + margin: 15px; + } + + .list__image-link { + background: $softGrey; + width: 100%; + height: 100%; + img { max-width: 100%; max-height: 100%; diff --git a/src/index.js b/src/index.js index 3777480..0f8d2bb 100755 --- a/src/index.js +++ b/src/index.js @@ -85,11 +85,11 @@ function stateConfig($stateProvider, $urlRouterProvider) { }) .state('main.game', { abstract: true, - url: '/game', + url: '/games', template: '

Loading

', }) .state('main.game.category', { - url: '/category', + url: '/add-category?country', template: '', resolve: {}, }); diff --git a/src/services/wiki.service.js b/src/services/wiki.service.js index 617f157..01c6fa8 100755 --- a/src/services/wiki.service.js +++ b/src/services/wiki.service.js @@ -1,7 +1,8 @@ import _ from 'lodash'; -const WikiService = function ($http, $httpParamSerializerJQLike) { +const WikiService = function ($http, $httpParamSerializerJQLike, $q, wikidata) { const service = { + addCategory, getArticleHeader, getFilesCategories, getCategoryInfo, @@ -35,6 +36,28 @@ const WikiService = function ($http, $httpParamSerializerJQLike) { // functions + function addCategory(id, value) { + return wikidata.get({ ids: id }) + .then((response) => { + const entry = response.entities[id]; + return entry.claims.P373; + }) + .then((response) => { + if (response) { + return $q.reject('Category is already added'); + } + return setClaim({ + action: 'wbcreateclaim', + format: 'json', + entity: `${id}`, + property: 'P373', + snaktype: 'value', + summary: '#monumental', + value: `"${value}"`, + }); + }); + } + function getArticleHeader(lang, title) { const params = angular.extend({}, defaultParams, { prop: 'extracts', @@ -79,7 +102,7 @@ const WikiService = function ($http, $httpParamSerializerJQLike) { const params = angular.extend({}, defaultParams, { prop: 'categories', clshow: '!hidden', - cllimit: '100', + cllimit: '250', titles: files.join('|'), }); return $http.jsonp('https://commons.wikimedia.org/w/api.php', { @@ -128,6 +151,9 @@ const WikiService = function ($http, $httpParamSerializerJQLike) { url: '/api', data: $httpParamSerializerJQLike(angular.extend({ use_auth: true }, params)), headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + }).then((response) => { + if (response.data.status === 'exception') { return $q.reject(response.data.exception); } + return response; }); } }; From 7760523d20eecc28c548957f40c3f56c1f92d9ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sat, 25 Mar 2017 23:34:47 +0100 Subject: [PATCH 31/47] fix(toolbar): visual fix --- src/components/toolbar/toolbar.html | 9 +++++++-- src/components/toolbar/toolbar.scss | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/toolbar/toolbar.html b/src/components/toolbar/toolbar.html index ca3f0ad..785a0eb 100644 --- a/src/components/toolbar/toolbar.html +++ b/src/components/toolbar/toolbar.html @@ -27,6 +27,11 @@
-
- Logout +
+
+ + Logout +
\ No newline at end of file diff --git a/src/components/toolbar/toolbar.scss b/src/components/toolbar/toolbar.scss index a258fba..68c15e1 100644 --- a/src/components/toolbar/toolbar.scss +++ b/src/components/toolbar/toolbar.scss @@ -37,8 +37,12 @@ .toolbar__settings { position: absolute; - width: calc(100% - 50px); + width: 100%; z-index: 10; - padding: 20px 25px; + padding: 10px 25px; background: white; + + .toolbar__column { + max-width: 980px; + } } \ No newline at end of file From e7fc7af344d5b70306b228b9352aeb16da58325c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sat, 25 Mar 2017 23:36:00 +0100 Subject: [PATCH 32/47] feat(monument): add link to number of wiki, small fixes --- src/components/main/monument/monument.html | 6 +++--- src/components/main/monument/monument.js | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/main/monument/monument.html b/src/components/main/monument/monument.html index 667fec3..c76c533 100755 --- a/src/components/main/monument/monument.html +++ b/src/components/main/monument/monument.html @@ -20,7 +20,7 @@

- Wikidata + Wikidata
@@ -38,7 +38,7 @@

description - {{ $ctrl.monument.interwikis || 0 }} wikis + {{ $ctrl.monument.interwikis || 0 }} wikis
@@ -57,7 +57,7 @@

-
+
diff --git a/src/components/main/monument/monument.js b/src/components/main/monument/monument.js index 9eb0657..a4a2d59 100755 --- a/src/components/main/monument/monument.js +++ b/src/components/main/monument/monument.js @@ -83,8 +83,7 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora function getWikidata() { vm.loading = true; wikidata.getById(id).then((data) => { - const first = Object.keys(data)[0]; - vm.monument = data[first]; + vm.monument = _.sample(data); const claims = vm.monument.claims; getImage(); From ad7d35ba8917b81322a54229f6e7e19662ab1b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sun, 26 Mar 2017 23:00:12 +0200 Subject: [PATCH 33/47] feat(app): clean-up language setup --- src/components/main/dashboard/dashboard.js | 14 ++++++------- src/components/main/list/list.js | 9 +++----- src/components/main/main.js | 12 +---------- src/components/main/map/map.js | 7 ++----- src/components/main/monument/monument.js | 7 ++----- src/index.js | 2 +- src/services/lang.service.js | 24 ++++++++++++++++++++-- src/services/wikidata.service.js | 9 ++------ 8 files changed, 40 insertions(+), 44 deletions(-) diff --git a/src/components/main/dashboard/dashboard.js b/src/components/main/dashboard/dashboard.js index b3e4c52..784af97 100755 --- a/src/components/main/dashboard/dashboard.js +++ b/src/components/main/dashboard/dashboard.js @@ -3,18 +3,18 @@ import template from './dashboard.html'; const DashboardComponent = { controller, template }; -function controller($state, $window, WikiService, localStorageService) { +function controller($mdToast, $state, $window, WikiService, langService) { const vm = this; - vm.languages = localStorageService.get('languages') || ['en', 'de']; + vm.languages = langService.getUserLanguages(); vm.loading = false; vm.saveLanguages = saveLanguages; function saveLanguages() { - if (vm.languages.includes('en')) { - vm.languages.push('en'); - } - localStorageService.set('languages', vm.languages.filter(lang => lang)); - $state.reload(); + langService.setUserLanguages(vm.languages.filter(lang => lang)) + .then(() => { + $mdToast.show($mdToast.simple().textContent('Languages saved!').hideDelay(3000)); + $state.reload(); + }); } } diff --git a/src/components/main/list/list.js b/src/components/main/list/list.js index 933f4e1..6030994 100755 --- a/src/components/main/list/list.js +++ b/src/components/main/list/list.js @@ -4,13 +4,15 @@ import '../../../images/marker.png'; const ListComponent = { controller, template }; -function controller($state, $stateParams, $timeout, leafletData, localStorageService, mapService, WikiService, wikidata) { +function controller($state, $stateParams, $timeout, langService, leafletData, localStorageService, mapService, WikiService, wikidata) { const vm = this; const icon = mapService.getMapIcon(); const id = $stateParams.id.includes('Q') ? $stateParams.id : `Q${$stateParams.id}`; + const langs = langService.getUserLanguages(); vm.filters = {}; vm.image = []; + vm.lang = langs[0]; vm.map = mapService.getMapInstance({ center: { lat: 49.4967, lng: 12.4805, zoom: 4 } }); vm.listParams = {}; @@ -19,11 +21,6 @@ function controller($state, $stateParams, $timeout, leafletData, localStorageSer return; } - let langs = $stateParams.lang ? [$stateParams.lang] : []; - langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); - vm.lang = langs[0]; - wikidata.setLanguages(langs); - init(); function getImage(image) { diff --git a/src/components/main/main.js b/src/components/main/main.js index efc6a08..6895270 100755 --- a/src/components/main/main.js +++ b/src/components/main/main.js @@ -4,18 +4,8 @@ import pack from '../../../package.json'; const MainComponent = { controller, template }; -function controller(wikidata, $state, $stateParams, localStorageService) { +function controller() { const vm = this; - - let langs = $stateParams.lang ? [$stateParams.lang] : []; - langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); - - vm.lang = langs[0]; - wikidata.setLanguages(langs); - - vm.goToItem = item => $state.go('main.object', { id: item.title.substring(1) }); - vm.querySearch = text => wikidata.getSearch(text); - vm.search = {}; } export default () => { diff --git a/src/components/main/map/map.js b/src/components/main/map/map.js index e3b4a1c..7b6b23d 100755 --- a/src/components/main/map/map.js +++ b/src/components/main/map/map.js @@ -3,9 +3,10 @@ import template from './map.html'; const MapComponent = { controller, template }; -function controller($location, $scope, $state, $stateParams, $timeout, leafletData, localStorageService, mapService, wikidata) { +function controller($location, $scope, $state, $stateParams, $timeout, langService, leafletData, localStorageService, mapService, wikidata) { const vm = this; const icon = mapService.getMapIcon(); + const langs = langService.getUserLanguages(); // bindings @@ -17,10 +18,6 @@ function controller($location, $scope, $state, $stateParams, $timeout, leafletDa // activate - let langs = $stateParams.lang ? [$stateParams.lang] : []; - langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); - wikidata.setLanguages(langs); - $scope.$on('centerUrlHash', (event, centerHash) => { $location.search({ c: centerHash }); }); diff --git a/src/components/main/monument/monument.js b/src/components/main/monument/monument.js index a4a2d59..6b491ee 100755 --- a/src/components/main/monument/monument.js +++ b/src/components/main/monument/monument.js @@ -10,16 +10,13 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora const vm = this; const icon = mapService.getMapIcon(); const id = $stateParams.id.includes('Q') ? $stateParams.id : `Q${$stateParams.id}`; + const langs = langService.getUserLanguages(); vm.getCommonsLink = getCommonsLink; vm.image = []; + vm.lang = langs[0]; vm.map = {}; - let langs = $stateParams.lang ? [$stateParams.lang] : []; - langs = langs.concat(localStorageService.get('languages') || ['en', 'de']); - - vm.lang = langs[0]; - wikidata.setLanguages(langs); getWikidata(); // functions diff --git a/src/index.js b/src/index.js index 0f8d2bb..b9c1695 100755 --- a/src/index.js +++ b/src/index.js @@ -79,7 +79,7 @@ function stateConfig($stateProvider, $urlRouterProvider) { resolve: {}, }) .state('main.object', { - url: '/object/:id?lang', + url: '/object/:id', template: '', resolve: {}, }) diff --git a/src/services/lang.service.js b/src/services/lang.service.js index 3e3bc8e..e193445 100644 --- a/src/services/lang.service.js +++ b/src/services/lang.service.js @@ -1,6 +1,8 @@ -const LangService = function () { +const LangService = function ($q, localStorageService) { const service = { getNativeLanguages, + getUserLanguages, + setUserLanguages, }; const languagesList = { @@ -19,7 +21,7 @@ const LangService = function () { Q902: ['bn'], Q244: ['en'], Q184: ['ru', 'be'], - Q31: ['fr', 'de', 'nl'], + Q31: ['nl', 'fr', 'de'], Q242: ['en'], Q962: ['fr'], Q917: ['dz'], @@ -194,6 +196,7 @@ const LangService = function () { Q953: ['en'], Q954: ['en'], }; + let userLanguages = []; return service; @@ -202,6 +205,23 @@ const LangService = function () { function getNativeLanguages(code) { return languagesList[code]; } + + function getUserLanguages() { + if (userLanguages.length) { return userLanguages; } + + const ls = localStorageService.get('languages'); + const def = navigator.language || navigator.userLanguage; + + userLanguages = ls || [def]; + if (!userLanguages.includes('en')) { userLanguages.push('en'); } + return userLanguages; + } + + function setUserLanguages(langs) { + localStorageService.set('languages', langs); + userLanguages = langs; + return $q.when(true); + } }; export default () => { diff --git a/src/services/wikidata.service.js b/src/services/wikidata.service.js index d50cda3..29d40b1 100755 --- a/src/services/wikidata.service.js +++ b/src/services/wikidata.service.js @@ -1,4 +1,4 @@ -const wdService = function ($http) { +const wdService = function ($http, $q, langService) { const service = { get, getById, @@ -6,14 +6,13 @@ const wdService = function ($http) { getRecursive, getSearch, getSPARQL, - setLanguages, }; const defaultParams = { action: 'wbgetentities', format: 'json', props: ['info', 'labels', 'aliases', 'descriptions', 'claims', 'datatype', 'sitelinks'], - languages: ['en'], + languages: langService.getUserLanguages(), callback: 'JSON_CALLBACK', }; @@ -103,10 +102,6 @@ const wdService = function ($http) { return result; } - function setLanguages(languages) { - defaultParams.languages = languages; - } - function simplifyAliases(aliases) { return mapValues(aliases, lang => lang.map(alias => alias.value)); } From 53f2871db488cbed3bd29aa5c3e3b43aea7a3f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Sun, 26 Mar 2017 23:02:24 +0200 Subject: [PATCH 34/47] fix(services): load 50+ entities --- src/services/wikidata.service.js | 37 ++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/services/wikidata.service.js b/src/services/wikidata.service.js index 29d40b1..6bde0bd 100755 --- a/src/services/wikidata.service.js +++ b/src/services/wikidata.service.js @@ -48,24 +48,33 @@ const wdService = function ($http, $q, langService) { } function getLabels(ids) { - return get({ - ids, - props: ['labels'], - }).then(response => mapValues(response.entities, entity => simplifyLabels(entity.labels))); + const promises = []; + for (let i = 0; i < Math.ceil(ids.length / 50); i += 1) { + promises.push(get({ + ids: ids.slice(i * 50, ((i + 1) * 50) - 1), + props: ['labels'], + })); + } + return $q.all(promises).then((responses) => { + const result = {}; + responses.forEach((response) => { + const values = mapValues(response.entities, entity => simplifyLabels(entity.labels)); + angular.extend(result, values); + }); + return result; + }); } function getRecursive(element, recursiveProperty) { - let query = `SELECT ?parent ?parentLabel WHERE { - wd:`+ element + ` ` + recursiveProperty + `* ?parent . - SERVICE wikibase:label { bd:serviceParam wikibase:language "` + defaultParams.languages.join(', ') + `" } + const query = `SELECT ?parent ?parentLabel WHERE { + wd:${element} ${recursiveProperty}* ?parent . + SERVICE wikibase:label { bd:serviceParam wikibase:language "${defaultParams.languages.join(', ')}" } }`; - return getSPARQL(query).then(data => { - return data.map(element => ({ - link: element.parent.value.replace('entity', 'wiki'), - value_id: element.parent.value.substring(element.parent.value.indexOf('/Q') + 1), - value: element.parentLabel.value - })); - }); + return getSPARQL(query).then(data => data.map((element) => ({ + link: element.parent.value.replace('entity', 'wiki'), + value_id: element.parent.value.substring(element.parent.value.indexOf('/Q') + 1), + value: element.parentLabel.value, + }))); } function getSearch(text) { From 8e233abcc32c08e7aa67b7eacc95e41daeb74d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 27 Mar 2017 19:15:21 +0200 Subject: [PATCH 35/47] chore(app): add building for dev --- package.json | 1 + src/components/toolbar/toolbar.js | 6 +++--- src/index_dev.ejs | 1 + src/index_local.ejs | 1 + src/services/wiki.service.js | 6 +++--- webpack.config.js | 4 ++-- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 259c893..83c414c 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "start-live": "webpack-dev-server --content-base src --progress --colors", "start": "webpack --watch --content-base src --progress --colors", "build": "webpack --content-base src --progress", + "build-dev": "set NODE_ENV=dev&&webpack --content-base src --progress", "test": "echo OK" }, "devDependencies": { diff --git a/src/components/toolbar/toolbar.js b/src/components/toolbar/toolbar.js index ef08059..67dbb5a 100644 --- a/src/components/toolbar/toolbar.js +++ b/src/components/toolbar/toolbar.js @@ -30,7 +30,7 @@ function controller($mdToast, $state, $window, WikiService, wikidata) { $mdToast.show($mdToast.simple() .position('top right') .textContent(`${item.label} is not an architectural structure or territorial entity`) - .hideDelay(3000000)); + .hideDelay(2000)); } }); } @@ -44,11 +44,11 @@ function controller($mdToast, $state, $window, WikiService, wikidata) { function login() { vm.loading = true; - $window.location.pathname = '/login'; + $window.location.pathname = `${$window.__env.baseUrl}/login`; } function logout() { - $window.location.pathname = '/logout'; + $window.location.pathname = `${$window.__env.baseUrl}/logout`; } } diff --git a/src/index_dev.ejs b/src/index_dev.ejs index 491963a..65e79c3 100755 --- a/src/index_dev.ejs +++ b/src/index_dev.ejs @@ -11,6 +11,7 @@ (function (window) { window.__env = window.__env || {}; window.__env.name = 'dev'; + window.__env.baseUrl = '/monumental'; }(this)); diff --git a/src/index_local.ejs b/src/index_local.ejs index fe95050..92ea526 100755 --- a/src/index_local.ejs +++ b/src/index_local.ejs @@ -11,6 +11,7 @@ (function (window) { window.__env = window.__env || {}; window.__env.name = 'local'; + window.__env.baseUrl = ''; }(this)); diff --git a/src/services/wiki.service.js b/src/services/wiki.service.js index 01c6fa8..9001dc1 100755 --- a/src/services/wiki.service.js +++ b/src/services/wiki.service.js @@ -1,6 +1,6 @@ import _ from 'lodash'; -const WikiService = function ($http, $httpParamSerializerJQLike, $q, wikidata) { +const WikiService = function ($http, $httpParamSerializerJQLike, $q, $window, wikidata) { const service = { addCategory, getArticleHeader, @@ -131,7 +131,7 @@ const WikiService = function ($http, $httpParamSerializerJQLike, $q, wikidata) { } function getToken() { - return $http.get('/api', { + return $http.get(`${$window.__env.baseUrl}/api`, { params: { action: 'query', meta: 'tokens', @@ -148,7 +148,7 @@ const WikiService = function ($http, $httpParamSerializerJQLike, $q, wikidata) { function setClaim(params) { return $http({ method: 'POST', - url: '/api', + url: `${$window.__env.baseUrl}/api`, data: $httpParamSerializerJQLike(angular.extend({ use_auth: true }, params)), headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, }).then((response) => { diff --git a/webpack.config.js b/webpack.config.js index b40ade8..aea0ae1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -59,8 +59,8 @@ var config = { var ENV = process.env.NODE_ENV; if (ENV === 'prod' || ENV === 'dev') { config.output = { - path: path.join(__dirname, 'app', 'dist'), - publicPath: 'dist/', + path: path.join(__dirname, 'monumental', 'static', 'assets'), + publicPath: 'assets/', filename: 'bundle.min.js?v=' + package.version }; config.plugins = [ From f2f2ff97f756a484f2f6f2212b42aff4e6c79538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 27 Mar 2017 19:16:15 +0200 Subject: [PATCH 36/47] fix(list): get labels in native languages --- src/components/main/list/list.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/components/main/list/list.js b/src/components/main/list/list.js index 6030994..5743227 100755 --- a/src/components/main/list/list.js +++ b/src/components/main/list/list.js @@ -8,7 +8,7 @@ function controller($state, $stateParams, $timeout, langService, leafletData, lo const vm = this; const icon = mapService.getMapIcon(); const id = $stateParams.id.includes('Q') ? $stateParams.id : `Q${$stateParams.id}`; - const langs = langService.getUserLanguages(); + let langs = langService.getUserLanguages(); vm.filters = {}; vm.image = []; @@ -35,7 +35,7 @@ function controller($state, $stateParams, $timeout, langService, leafletData, lo WHERE { ?item p:P1435 ?monument; wdt:P131* wd:${id}; wdt:P131 ?admin; wdt:P625 ?coord . OPTIONAL { ?item wdt:P18 ?image } - OPTIONAL { ?admin rdfs:label ?adminLabel. FILTER(LANG(?adminLabel) = "${langs[0]}"). } + OPTIONAL { ?admin rdfs:label ?adminLabel . FILTER(LANG(?adminLabel) IN ("${langs[0]}")) } SERVICE wikibase:label { bd:serviceParam wikibase:language "${langs.join(',')}" } } GROUP BY ?item ?itemLabel @@ -43,20 +43,26 @@ function controller($state, $stateParams, $timeout, langService, leafletData, lo } function getPlace() { - wikidata.getById(id).then((data) => { + return wikidata.getById(id).then((data) => { const first = Object.keys(data)[0]; vm.place = data[first]; + const claims = vm.place.claims; if (vm.place.claims.P18) { - const claims = vm.place.claims; claims.P18.values.forEach(image => getImage(image.value)); } + if (vm.place.claims.P17) { + const country = claims.P17.values[0]; + langs = langs.concat(langService.getNativeLanguages(country.value_id)); + } + return true; }); } function init() { - getPlace(); - getList().then((data) => { + getPlace() + .then(() => getList()) + .then((data) => { // console.log(data) vm.list = data.map(element => ({ name: { From 160f977b1ad38769d600f57ae5f5263a5c2a2c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 27 Mar 2017 19:16:36 +0200 Subject: [PATCH 37/47] fix(app): small fixes --- src/services/lang.service.js | 4 ++-- src/styles/_general.scss | 14 +++++++++----- src/styles/_variables.scss | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/services/lang.service.js b/src/services/lang.service.js index e193445..6f2d5d3 100644 --- a/src/services/lang.service.js +++ b/src/services/lang.service.js @@ -207,14 +207,14 @@ const LangService = function ($q, localStorageService) { } function getUserLanguages() { - if (userLanguages.length) { return userLanguages; } + if (userLanguages.length) { return angular.copy(userLanguages); } const ls = localStorageService.get('languages'); const def = navigator.language || navigator.userLanguage; userLanguages = ls || [def]; if (!userLanguages.includes('en')) { userLanguages.push('en'); } - return userLanguages; + return angular.copy(userLanguages); } function setUserLanguages(langs) { diff --git a/src/styles/_general.scss b/src/styles/_general.scss index 801d1da..b0f2049 100755 --- a/src/styles/_general.scss +++ b/src/styles/_general.scss @@ -18,11 +18,6 @@ body { background: rgba(0,0,0,0.2); } -md-content { - margin: 20px; - background: transparent; -} - .container { background: #f5f5f5; min-height: calc(100vh - 64px); @@ -30,6 +25,11 @@ md-content { ui-view, ui-view > * { width: 100%; } + + & > md-content { + margin: 20px; + background: transparent; + } } //// @@ -48,6 +48,10 @@ a, a.link { color: $lightGrey; } +small { + font-size: 95%; +} + .full-width { width: 100%; } diff --git a/src/styles/_variables.scss b/src/styles/_variables.scss index d503224..512285b 100755 --- a/src/styles/_variables.scss +++ b/src/styles/_variables.scss @@ -1,5 +1,5 @@ $softGrey: #e5e5e5; -$lightGrey: rgba(0,0,0,0.34); +$lightGrey: rgba(0,0,0,0.38); $darkGrey: rgba(0,0,0,.87); $primary: #2980b9 From 73c0f3f7307e82f8f90327dcd6247d15b8b6d680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 27 Mar 2017 20:12:58 +0200 Subject: [PATCH 38/47] feat(monument): add map, clean-up legacy code --- src/components/main/monument/monument.html | 88 ++++++---------------- src/components/main/monument/monument.js | 8 +- src/components/main/monument/monument.scss | 4 +- 3 files changed, 31 insertions(+), 69 deletions(-) diff --git a/src/components/main/monument/monument.html b/src/components/main/monument/monument.html index c76c533..264280f 100755 --- a/src/components/main/monument/monument.html +++ b/src/components/main/monument/monument.html @@ -66,7 +66,7 @@

-
@@ -89,7 +89,7 @@

Wikipedia

-
+

Properties

Properties

-
- -
@@ -133,7 +136,7 @@

Map

--> - map Show monuments nearby + map Show all monuments nearby
diff --git a/src/components/main/monument/monument.js b/src/components/main/monument/monument.js index 5002da4..fd4b172 100755 --- a/src/components/main/monument/monument.js +++ b/src/components/main/monument/monument.js @@ -12,6 +12,7 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora const langs = langService.getUserLanguages(); vm.getCommonsLink = getCommonsLink; + vm.getWikipedia = getWikipedia; vm.image = []; vm.lang = langs[0]; vm.map = {}; @@ -35,7 +36,7 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora }); } - function getArticleHeader(lang, name) { + function getWikipedia(lang, name) { const language = lang.replace('wiki', ''); WikiService.getArticleHeader(language, name).then((data) => { vm.article = $sce.trustAsHtml(data); @@ -91,7 +92,7 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, localStora vm.monument.interwikis = Object.keys(vm.monument.interwiki).length; const articleInterwiki = vm.monument.interwiki[`${langs[0]}wiki`] || vm.monument.interwiki[`${langs[1]}wiki`] || vm.monument.interwiki[`${langs[2]}wiki`]; if (articleInterwiki) { - getArticleHeader(articleInterwiki.site, articleInterwiki.title); + getWikipedia(articleInterwiki.site, articleInterwiki.title); } if (vm.monument.claims.P625) { const value = vm.monument.claims.P625.values[0].value; diff --git a/src/components/main/monument/monument.scss b/src/components/main/monument/monument.scss index 43e45eb..58335cf 100755 --- a/src/components/main/monument/monument.scss +++ b/src/components/main/monument/monument.scss @@ -114,15 +114,15 @@ mo-monument { &.article__text--long { max-height: none; } + } - &:after { - // content: ""; - // position: absolute; top: 0; bottom: 0; left: -15px; right: -15px; - // box-shadow: inset rgb(255,255,255) 0 -20px 10px; - } + .article__more { + margin-top: -14px; + z-index: 5; + box-shadow: inset rgb(255,255,255) 0 -45px 15px; } - .md-button { + .md-icon-button { margin-top: -18px; } } From ed54db6370caeb4b0fa3d47cfcc40c65f5a2f342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 27 Mar 2017 21:58:36 +0200 Subject: [PATCH 41/47] fix(map): remove duplicates from the list --- src/components/main/map/map.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/main/map/map.js b/src/components/main/map/map.js index 7b6b23d..58c0ea0 100755 --- a/src/components/main/map/map.js +++ b/src/components/main/map/map.js @@ -52,7 +52,10 @@ function controller($location, $scope, $state, $stateParams, $timeout, langServi SERVICE wikibase:label { bd:serviceParam wikibase:language "${langs.join(',')}" } }`).then((data) => { vm.map.markers = {}; - vm.list = data.map(element => setListElement(element)); + // http://stackoverflow.com/a/36744732/1418878 + vm.list = data + .map(element => setListElement(element)) + .filter((element, index, array) => array.findIndex(t => t.name.value_id === element.name.value_id) === index); vm.list.forEach((element) => { vm.map.markers[element.name.value_id] = setMarker(element); }); From 9fbfe689ba6803dd42680e08dc1f9955113ae219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 27 Mar 2017 21:59:14 +0200 Subject: [PATCH 42/47] feat(app): set missing titles --- src/components/main/dashboard/dashboard.js | 6 ++++++ src/components/main/games/category/games-category.js | 2 ++ src/components/main/list/list.js | 9 +++++++-- src/components/main/map/map.js | 4 +++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/components/main/dashboard/dashboard.js b/src/components/main/dashboard/dashboard.js index 784af97..d47f19f 100755 --- a/src/components/main/dashboard/dashboard.js +++ b/src/components/main/dashboard/dashboard.js @@ -9,6 +9,12 @@ function controller($mdToast, $state, $window, WikiService, langService) { vm.loading = false; vm.saveLanguages = saveLanguages; + init(); + + function init() { + $window.document.title = 'Dashboard – Monumental'; + } + function saveLanguages() { langService.setUserLanguages(vm.languages.filter(lang => lang)) .then(() => { diff --git a/src/components/main/games/category/games-category.js b/src/components/main/games/category/games-category.js index 79c9520..20e7bfa 100644 --- a/src/components/main/games/category/games-category.js +++ b/src/components/main/games/category/games-category.js @@ -66,6 +66,8 @@ function controller($q, $state, $stateParams, $window, WikiService, langService, vm.loading = true; vm.list = []; + $window.document.title = 'Monumental'; + getCountry(); getList() .then((response) => { diff --git a/src/components/main/list/list.js b/src/components/main/list/list.js index 5b643ee..f3b9ad5 100755 --- a/src/components/main/list/list.js +++ b/src/components/main/list/list.js @@ -3,7 +3,7 @@ import template from './list.html'; const ListComponent = { controller, template }; -function controller($state, $stateParams, $timeout, langService, leafletData, localStorageService, mapService, WikiService, wikidata) { +function controller($state, $stateParams, $timeout, $window, langService, leafletData, localStorageService, mapService, WikiService, wikidata) { const vm = this; const icon = mapService.getMapIcon(); const id = $stateParams.id.includes('Q') ? $stateParams.id : `Q${$stateParams.id}`; @@ -60,7 +60,12 @@ function controller($state, $stateParams, $timeout, langService, leafletData, lo function init() { getPlace() - .then(() => getList()) + .then(() => { + const title = vm.place.labels[vm.lang] || vm.place.labels.en || vm.place.id; + $window.document.title = `${title} – Monumental`; + + return getList(); + }) .then((data) => { // console.log(data) vm.list = data.map(element => ({ diff --git a/src/components/main/map/map.js b/src/components/main/map/map.js index 58c0ea0..0a9ee28 100755 --- a/src/components/main/map/map.js +++ b/src/components/main/map/map.js @@ -3,7 +3,7 @@ import template from './map.html'; const MapComponent = { controller, template }; -function controller($location, $scope, $state, $stateParams, $timeout, langService, leafletData, localStorageService, mapService, wikidata) { +function controller($location, $scope, $state, $stateParams, $timeout, $window, langService, leafletData, localStorageService, mapService, wikidata) { const vm = this; const icon = mapService.getMapIcon(); const langs = langService.getUserLanguages(); @@ -36,6 +36,8 @@ function controller($location, $scope, $state, $stateParams, $timeout, langServi }); }, 100); + $window.document.title = 'Monumental'; + // functions function getDataBB(bounds) { From b8b0ecc7d8ed505f1a28b60706b23e6eb60236bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 27 Mar 2017 21:59:30 +0200 Subject: [PATCH 43/47] fix(map): visual fixes for map --- src/components/main/map/map.scss | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/main/map/map.scss b/src/components/main/map/map.scss index 18ed654..7e7d38e 100755 --- a/src/components/main/map/map.scss +++ b/src/components/main/map/map.scss @@ -10,6 +10,9 @@ mo-map { .list__container { margin-right: 20px; + background: white; + border: 1px solid $softGrey; + border-radius: 2px; md-list-item.md-2-line { border-bottom: 1px solid $softGrey; @@ -58,7 +61,9 @@ mo-map { } .list__map { - background: $softGrey; + background: white; + border: 1px solid $softGrey; + border-radius: 2px; .angular-leaflet-map { width: 100%; From 48e0f35c6a55b9dfe6a07c831472e54305b43149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 27 Mar 2017 22:29:54 +0200 Subject: [PATCH 44/47] feat(category): add error toast --- src/components/main/games/category/games-category.js | 5 +++-- src/styles/_general.scss | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/main/games/category/games-category.js b/src/components/main/games/category/games-category.js index 20e7bfa..e9afcb6 100644 --- a/src/components/main/games/category/games-category.js +++ b/src/components/main/games/category/games-category.js @@ -5,7 +5,7 @@ import template from './games-category.html'; const GamesCategoryComponent = { controller, template }; -function controller($q, $state, $stateParams, $window, WikiService, langService, wikidata) { +function controller($mdToast, $q, $state, $stateParams, $window, WikiService, langService, wikidata) { const vm = this; const id = $stateParams.country.includes('Q') ? $stateParams.country : `Q${$stateParams.country}`; @@ -14,7 +14,7 @@ function controller($q, $state, $stateParams, $window, WikiService, langService, { name: 'Germany', code: 'Q183' }, { name: 'Great Britain', code: 'Q145' }, { name: 'Poland', code: 'Q36' }, - { name: 'the United States', code: 'Q30' }, + { name: 'the USA', code: 'Q30' }, ]; vm.country = id || 'Q36'; vm.loading = true; @@ -113,6 +113,7 @@ function controller($q, $state, $stateParams, $window, WikiService, langService, }).catch((err) => { item.error = err; item.loading = false; + $mdToast.show($mdToast.simple().textContent(`Error: ${err}`).hideDelay(3000)); }); } } diff --git a/src/styles/_general.scss b/src/styles/_general.scss index b0f2049..099d413 100755 --- a/src/styles/_general.scss +++ b/src/styles/_general.scss @@ -1,6 +1,7 @@ @import 'variables'; html, body { + height: auto !important; min-width: 100%; min-height: 100%; } @@ -8,6 +9,14 @@ html, body { body { color: $darkGrey; font: 16px Roboto, Arial, sans-serif; + + md-toast.md-bottom { + position: fixed; + } + + &.md-toast-animating { + overflow: auto !important; + } } ::-webkit-scrollbar { From aae443a80b7b924110d9da639566ec67f66a58eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 27 Mar 2017 22:30:15 +0200 Subject: [PATCH 45/47] feat(dashboard): links cleanup --- src/components/main/dashboard/dashboard.html | 30 ++++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/components/main/dashboard/dashboard.html b/src/components/main/dashboard/dashboard.html index 202082a..e5e9855 100755 --- a/src/components/main/dashboard/dashboard.html +++ b/src/components/main/dashboard/dashboard.html @@ -126,15 +126,27 @@

Examples

Set language

From 021948a0d3a899a32a446a3080a47ddd16d91ba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 27 Mar 2017 22:30:38 +0200 Subject: [PATCH 46/47] fix(category): enable button for tooltip --- src/components/main/games/category/games-category.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/main/games/category/games-category.html b/src/components/main/games/category/games-category.html index 8834879..e68cc33 100644 --- a/src/components/main/games/category/games-category.html +++ b/src/components/main/games/category/games-category.html @@ -17,7 +17,7 @@ Click plus next to category sugestion to add it.
- + This is cached value. It means it is not updated real-time. {{$ctrl.total}} results From 6c098764acc1c83aeb21e052e752a2cb34f20df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Mon, 27 Mar 2017 22:34:31 +0200 Subject: [PATCH 47/47] version 17.03.01 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 83c414c..ecbf1a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monumental", - "version": "0.10.0", + "version": "17.03.01", "private": true, "description": "Monumental app", "main": "src/index.js",