diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5e5f137 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/bower_components/ +/nbproject/ +/node_modules/ diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..8f15b2f --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,27 @@ +module.exports = function (grunt) { + // Project configuration. + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + uglify: { + my_target: { + files: { + 'assets/js/vitraux-visiteurs.min.js': [ + 'assets/js/partials/_main.js', + 'assets/js/partials/_courses.js', + 'assets/js/partials/_map.js', + 'assets/js/partials/_explore.js', + 'assets/js/partials/_preview.js', + 'assets/js/partials/_description.js' + ] + } + } + } + }); + + // Load the plugin that provides the "uglify" task. + grunt.loadNpmTasks('grunt-contrib-uglify'); + + // Default task(s). + grunt.registerTask('default', ['uglify']); + +}; diff --git a/README.md b/README.md new file mode 100644 index 0000000..8c232ec --- /dev/null +++ b/README.md @@ -0,0 +1,73 @@ +# Vitraux Visiteurs + +Vitraux Visiteurs is a Web App built to guide people into discovering the beauty +and history of stained-glass windows in Troyes, France. + +## Table of contents + +* [Setting up the development environment](#setting-up-the-development-environment) +* [Adding packages as dependencies](#adding-packages-as-dependencies) +* [Using Grunt](#using-grunt) +* [Versioning](#versioning) +* [Creators](#creators) +* [Copyright and licence](#copyright-and-licence) + +## Setting up the development environment + +1. [Install Bower](http://bower.io/#install-bower) +2. Open command line +3. Go to project root folder +4. Run the following command to install project dependencies: + +``` +bower install +``` + +## Adding packages as dependencies + +You can search packages [here](https://bower.io/search/) and install them with the following command: + +``` +bower install --save +``` + +Care to know more about Bower? [Bower docs](http://bower.io/docs/api/) + + +## Using Grunt + +If you want to configure or use the project tasks, [install Grunt](http://gruntjs.com/getting-started) +The Gruntfile.js is setup to launch the following task(s) with the `grunt` command: + +* [Uglify](https://github.com/gruntjs/grunt-contrib-uglify) to compress and mangle javascript files into vitraux-visiteurs.min.js + +## Versioning + +Vitraux Visiteurs is maintained under [the Semantic Versioning guidelines](http://semver.org/). + +## Creators + +This is a school project for the [University of Technology of Troyes +(UTT)](http://www.utt.fr/) + +**Professor:** + +* [Aurélien Bénel](https://github.com/benel) + +**Student Team:** + +* [Yassine Doghri](https://github.com/yassinedoghri) +* [Amine Benjelloun](https://github.com/aminebenj) +* [Denis Chenesseau](https://github.com/Wolfsister) +* [Alexandre Patelli](https://github.com/alexandrepa) +* [Maxime Couture](https://github.com/MaximeCouture) +* [Helene Ardo Sow](https://github.com/titiardo) +* [Othman Tariq](https://github.com/othmanetariq) +* [Nora Ouelasri](https://github.com/ouelasrn) +* [Imane Tarchoun](https://github.com/imaneIT) +* [Damien Brandao](https://github.com/brandaod) + +## Copyright and licence + +Code and documentation copyright 2016 Hypertopic. +// TO DO - Project licence. diff --git a/assets/css/main.css b/assets/css/main.css new file mode 100644 index 0000000..e1b41d3 --- /dev/null +++ b/assets/css/main.css @@ -0,0 +1,2 @@ +.search-bar{background-color:#f9c452;position:fixed;height:44px;top:44px;left:0;width:100%;border-bottom:1px solid #d9a941;z-index:10}.search-bar .search{background-color:transparent;border:none;border-bottom:2px solid rgba(254,254,254,0.5);color:#fefefe;border-radius:0;margin-bottom:0;margin-right:15px;margin-left:15px;padding-left:35px;width:calc(100% - 30px);-moz-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.search-bar .search:focus{border-bottom:2px solid #fefefe}.search-bar .search:focus+span{color:#fefefe}.search-bar .search:-moz-placeholder{color:rgba(254,254,254,0.8);font-style:italic}.search-bar .search::-moz-placeholder{color:rgba(254,254,254,0.8);font-style:italic}.search-bar .search:-ms-input-placeholder{color:rgba(254,254,254,0.8);font-style:italic}.search-bar .search::-webkit-input-placeholder{color:rgba(254,254,254,0.8);font-style:italic}.search-bar span{position:absolute;top:0;left:15px;padding:9px;color:rgba(254,254,254,0.5);-moz-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}#courses{padding-top:88px !important}.course .course-header{margin-bottom:10px}.course .course-header h2{font-size:20px;font-weight:400;margin-bottom:0}.course .course-abstract{font-weight:300}.course .course-abstract div{width:50%;float:left}.table-view{border:none}.social{display:inline-block;vertical-align:middle;width:50%;height:auto;text-align:center}.social span.fa{margin-left:10px}#vitrail-thumbnail{position:relative;text-align:center;display:inline-block;width:50%;height:auto;vertical-align:middle}#vitrail-thumbnail span.fa{color:rgba(255,255,255,0.8);text-shadow:0 0 5px rgba(0,0,0,0.8);position:absolute;bottom:10px;text-align:right;padding-right:5px;width:100%}#vitrail-thumbnail .thumbnail{width:100%}.description{text-align:justify}#vitrailModal #vitrail-resource{width:100%}#vitrailModal a.btn{position:absolute;bottom:0;margin:0}.table-img{width:100px}.table-view{margin-top:0 !important}.stained-glass-desc{float:right;width:50%}.stained-glass-img{float:left;width:50%;text-align:center}.place-info{padding-top:15px;padding-right:15px}.place-info .place-name{text-align:center}.place-info p{text-align:justify}.preview-img{width:100%;height:auto}#found-btn{position:absolute;bottom:0;margin:0}body{font-family:"Roboto"}button,input,select,textarea{font-family:"Roboto"}.bar-nav{background-color:#f9c452;border:none}.bar-nav h1{color:#fefefe}.bar-nav a{color:#fefefe} +/*# sourceMappingURL=main.css.map */ diff --git a/assets/css/main.css.map b/assets/css/main.css.map new file mode 100644 index 0000000..5d35e92 --- /dev/null +++ b/assets/css/main.css.map @@ -0,0 +1,7 @@ +{ +"version": 3, +"mappings": "AAUA,WAAY,CACR,gBAAgB,CALJ,OAAO,CAMnB,QAAQ,CAAE,KAAK,CACf,MAAM,CAAE,IAAI,CACZ,GAAG,CAAE,IAAI,CACT,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,IAAI,CACX,aAAa,CAAE,iBAA+B,CAC9C,OAAO,CAAE,EAAE,CAEX,mBAAQ,CACJ,gBAAgB,CAAE,WAAW,CAC7B,MAAM,CAAE,IAAI,CACZ,aAAa,CAAE,+B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BAAgC,CAC5B,WAAW,CAAE,QAAQ,CAGzB,QAAS,CACL,gBAAgB,CAbJ,OAAO,CAcnB,MAAM,CAAE,IAAI,CAEZ,WAAG,CACC,KAAK,CAfC,OAAO,CAiBjB,UAAE,CACE,KAAK,CAlBC,OAAO", +"sources": ["scss/pages/_courses.scss","file:///C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/compass-core-1.0.3/stylesheets/compass/_support.scss","file:///C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/compass-core-1.0.3/stylesheets/compass/css3/_transition.scss","file:///C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/compass-core-1.0.3/stylesheets/compass/css3/_user-interface.scss","scss/pages/_description.scss","scss/pages/_explore.scss","scss/pages/_preview.scss","scss/main.scss"], +"names": [], +"file": "main.css" +} diff --git a/assets/css/scss/main.scss b/assets/css/scss/main.scss new file mode 100644 index 0000000..b8087cf --- /dev/null +++ b/assets/css/scss/main.scss @@ -0,0 +1,34 @@ +/* + Created on : 26 mai 2016, 20:10:40 + Author : Yassine Doghri +*/ + +@import "pages/courses"; +@import "pages/description"; +@import "pages/explore"; +@import "pages/preview"; + +@import "compass"; +$primary-color: #f9c452; +$primary-color-darker: #d9a941; +$light-color: #fefefe; + +body { + font-family: "Roboto"; +} + +button, input, select, textarea { + font-family: "Roboto"; +} + +.bar-nav { + background-color: $primary-color; + border: none; + + h1 { + color: $light-color; + } + a { + color: $light-color; + } +} \ No newline at end of file diff --git a/assets/css/scss/pages/_courses.scss b/assets/css/scss/pages/_courses.scss new file mode 100644 index 0000000..16bab26 --- /dev/null +++ b/assets/css/scss/pages/_courses.scss @@ -0,0 +1,86 @@ +/* + Created on : 18 juin 2016, 13:23:15 + Author : Yassine Doghri +*/ + +@import "compass"; +$primary-color: #f9c452; +$primary-color-darker: #d9a941; +$light-color: #fefefe; + +.search-bar { + background-color: $primary-color; + position: fixed; + height: 44px; + top: 44px; + left: 0; + width: 100%; + border-bottom: 1px solid $primary-color-darker; + z-index: 10; + + .search { + background-color: transparent; + border: none; + border-bottom: 2px solid rgba($light-color, 0.5); + color: $light-color; + border-radius: 0; + margin-bottom: 0; + margin-right: 15px; + margin-left: 15px; + padding-left: 35px; + width : calc(100% - 30px); + @include transition(all 0.3s ease-in-out); + + &:focus { + border-bottom: 2px solid rgba($light-color, 1); + + +span { + color: $light-color; + } + } + + @include input-placeholder { + color: rgba($light-color, 0.8); + font-style: italic; + } + } + span { + position: absolute; + top: 0; + left: 15px; + padding: 9px; + color: rgba($light-color, 0.5); + @include transition(all 0.3s ease-in-out); + } +} + +#courses { + padding-top: 88px!important; +} + +.course { + .course-header { + margin-bottom: 10px; + + h2 { + font-size: 20px; + font-weight: 400; + margin-bottom: 0; + } + .course-vp { + + } + } + .course-abstract { + font-weight: 300; + + div { + width: 50%; + float: left; + } + } +} + +.table-view { + border: none; +} \ No newline at end of file diff --git a/assets/css/scss/pages/_description.scss b/assets/css/scss/pages/_description.scss new file mode 100644 index 0000000..db9ab0a --- /dev/null +++ b/assets/css/scss/pages/_description.scss @@ -0,0 +1,56 @@ +/* + Created on : 10 juin 2016, 00:54:33 + Author : Maxime Couture +*/ + +.social{ + display: inline-block; + vertical-align: middle; + width: 50%; + height: auto; + text-align: center; + + span.fa { + margin-left: 10px; + } +} + +#vitrail-thumbnail { + position: relative; + text-align: center; + display: inline-block; + width: 50%; + height: auto; + vertical-align: middle; + + span.fa { + color: rgba(#fff, 0.8); + text-shadow: 0 0 5px rgba(#000, 0.8); + position: absolute; + bottom: 10px; + text-align: right; + padding-right: 5px; + width: 100%; + } + + .thumbnail { + width: 100%; + } +} + +.description { + text-align: justify; +} + +#vitrailModal { + + #vitrail-resource { + width: 100%; + } + + a.btn { + position: absolute; + bottom: 0; + margin: 0; + } +} diff --git a/assets/css/scss/pages/_explore.scss b/assets/css/scss/pages/_explore.scss new file mode 100644 index 0000000..474d004 --- /dev/null +++ b/assets/css/scss/pages/_explore.scss @@ -0,0 +1,27 @@ +.table-img { + width: 100px; +} +.table-view { + margin-top: 0!important; +} +.stained-glass-desc { + float:right; + width: 50%; + +} +.stained-glass-img { + float:left; + width: 50%; + text-align: center; +} + +.place-info { + padding-top: 15px; + padding-right: 15px; + .place-name { + text-align: center; + } + p { + text-align: justify; + } +} diff --git a/assets/css/scss/pages/_preview.scss b/assets/css/scss/pages/_preview.scss new file mode 100644 index 0000000..a3646cd --- /dev/null +++ b/assets/css/scss/pages/_preview.scss @@ -0,0 +1,10 @@ +.preview-img { + width: 100%; + height: auto; +} + +#found-btn { + position: absolute; + bottom: 0; + margin: 0; +} \ No newline at end of file diff --git a/assets/img/favicon.ico b/assets/img/favicon.ico new file mode 100644 index 0000000..d952b44 Binary files /dev/null and b/assets/img/favicon.ico differ diff --git a/assets/js/partials/_courses.js b/assets/js/partials/_courses.js new file mode 100644 index 0000000..43bf7b5 --- /dev/null +++ b/assets/js/partials/_courses.js @@ -0,0 +1,130 @@ +function initList() { + // List.js + var options = { + valueNames: [ + 'course-title', + 'course-vp', + 'distance', + 'locations', + 'duration', + 'items-nb', + {data: ['id']}, + {attr: 'href', name: 'topic-link'} + ], + item: '
  • ' + + '' + + '
    ' + + '
    ' + + '

    ' + + '

    ' + + '
    ' + + '
    ' + + '
    ' + + '

    ' + + ' ' + + ' km' + + '

    ' + + '

    ' + + ' ' + + '' + + '

    ' + + '
    ' + + '
    ' + + '

    ' + + ' ' + + '' + + '

    ' + + '

    ' + + '' + + '

    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
  • ' + }; + courseList = new List('courses', options); +} + +function getCoursesList() { + var viewpoints = [ + { + "id": "56e092d8a6179a788c74b618b29801c0", + "name": "Histoire des religions" + }, + { + "id": "a76306e4f17ed4f79e7e481eb9a1bd06", + "name": "Histoire de l'art" + } + ]; + // GET Corpus Before + $.ajax({ + type: 'GET', + url: 'http://argos2.hypertopic.org/corpus/Vitraux - Bénel', + dataType: 'json', + success: function (corpus) { + $.each(viewpoints, function (index, vp) { + $.ajax({ + type: 'GET', + url: 'http://argos2.hypertopic.org/viewpoint/' + vp.id, + dataType: 'json', + success: function (data) { + $.each(data.rows, function (index, row) { + var topic_title = ''; + var topic_id = ''; + var items = []; + var locations = []; + var link = ''; + // If topic exists (leaf) + if (row.value.narrower) { + $('#courses-num').text(parseInt($('#courses-num').text()) + 1); + topic_title = row.value.narrower.name; + topic_id = row.value.narrower.id; + link = 'map.html?viewpoint=' + vp.id + '&topic=' + topic_id; + courseList.add({ + 'id': topic_id, + 'course-title': 'Parcours "' + topic_title + '"', + 'course-vp': "— " + vp.name, + 'distance': '0', + 'locations': '0 Lieux', + 'duration': '0', + 'items-nb': '0 Vitraux' + }); + var item = courseList.get('id', topic_id)[0]; + item.values({ + 'topic-link': link + }); + + $.each(corpus.rows, function (index, row) { + if (row.value.topic) { + if (row.value.topic['viewpoint'] === vp.id && row.value.topic['id'] === topic_id) { + items.push(row.id); + var item_count = parseInt(item.values()['items-nb'].replace(/^\D+/g, '')) + 1; + item.values({ + 'items-nb': item_count + ' ' + getItemText(item_count, "Vitrail", "Vitraux") + }); + } + } + }); + $.each(corpus.rows, function (index, row) { + if (row.value.spatial) { + if ($.inArray(row.id, items) > -1) { + locations.push(row.value.spatial); + } + } + }); + locations = uniq(locations); + var locations_nb = locations.length; + var duration = getCourseDuration(locations_nb * 30); + item.values({ + 'locations': locations_nb + ' ' + getItemText(locations_nb, "Lieu", "Lieux"), + 'duration': duration + }); + } + }); + } + }); + }); + } + }); +} diff --git a/assets/js/partials/_description.js b/assets/js/partials/_description.js new file mode 100644 index 0000000..be14ae9 --- /dev/null +++ b/assets/js/partials/_description.js @@ -0,0 +1,35 @@ +function getDescription() { + var id = getUrlParameter("id"); + var spatial = getUrlParameter("spatial"); + var viewpoint = getUrlParameter("viewpoint"); + var topic = getUrlParameter("topic"); + + $('#back').attr('href', 'explore.html?topic=' + topic + '&viewpoint=' + viewpoint + '&spatial=' + spatial); + + $.ajax({ + url: "http://steatite.hypertopic.org/corpus/Vitraux - Bénel", + type: "GET", + dataType: 'json', + success: function (data) { + var name, thumb, imgUri; + $.each(data.rows, function (index, r) { + if (r.key[1] === id) { + if (r.value.name) { + name = r.value.name; + } else if (r.value.thumbnail) { + thumb = r.value.thumbnail; + } else if (r.value.resource) { + imgUri = r.value.resource; + } + } + }); + $(".title").text(name); + $("#vitrailModal").find('.title').text(name + " [Zoom]"); + $("#vitrailModal").find('a.btn').attr('href', imgUri); + $("#vitrail-thumbnail").find("img").attr("src", thumb); + $("#vitrail-thumbnail").find("img").attr("alt", name); + $("#vitrail-resource").attr("src", imgUri); + $("#vitrail-resource").attr("alt", name); + } + }); +} diff --git a/assets/js/partials/_explore.js b/assets/js/partials/_explore.js new file mode 100644 index 0000000..d689a61 --- /dev/null +++ b/assets/js/partials/_explore.js @@ -0,0 +1,81 @@ +function getLocationVitraux() { + if (getUrlParameter("viewpoint") !== undefined) { + var viewpoint = getUrlParameter("viewpoint"); + var topic = getUrlParameter("topic"); + var spatial = decodeURIComponent(getUrlParameter("spatial")); + } + $('#back').attr('href', 'map.html?+&viewpoint=' + viewpoint + '&topic=' + topic); + $('.place-name').text(spatial); + + $.ajax({ + url: 'http://argos2.hypertopic.org/topic/' + viewpoint + '/' + topic, + dataType: 'json', + success: function (data) { + $.each(data.rows, function (index, r) { + if (r.value.item && r.value.item.corpus === "Vitraux - Bénel") { + var name = ""; + var display = "none"; + if (r.value.item.name && r.value.item.name !== "Sans nom") { + name = r.value.item.name; + } + var item_id = r.value.item.id; + var url = 'preview.html?id=' + item_id + '&topic=' + topic + '&viewpoint=' + viewpoint + '&spatial=' + spatial; + if (localStorage.getItem(item_id)) { + display = "inline"; + url = 'description.html?id=' + item_id + '&topic=' + topic + '&viewpoint=' + viewpoint + '&spatial=' + spatial; + } + var item = '
  • ' + + '' + + '
    ' + + '

    ' + name + '

    ' + + '' + + '
    ' + + '
    ' + + '' + name + '' + + '
    ' + + '
    ' + + '
  • '; + $('#stainted-glass-windows').append(item); + + } else if (r.value.name) { + $(".title").text('Parcours "' + r.value.name + '"'); + } + }); + } + }); + $.ajax({ + url: 'http://steatite.hypertopic.org/corpus/Vitraux - Bénel', + dataType: 'json', + success: function (data) { + $.each(data.rows, function (index, s) { + if (s.value.thumbnail) { + $("#" + s.key[1]).find("img").attr('src', s.value.thumbnail); + } + if (s.value.name) { + $("#" + s.key[1]).find('.stained-glass-name').text(s.value.name); + $("#" + s.key[1]).find("img").attr('alt', s.value.name); + } + }); + } + }); + $.ajax({ + url: 'http://argos2.hypertopic.org/corpus/Vitraux - Bénel', + dataType: 'json', + success: function (corpus) { + $.each(corpus.rows, function (index, c) { + if (c.value.spatial) { + if (c.value.spatial !== spatial) { + var selector = $("#" + c.key[1]); + if (selector.length) { + selector.remove(); + } + } + } + }); + var nbItems = $("#stainted-glass-windows li").length - 1; + $("#text-info-vitraux1").text(getItemText(nbItems, "le vitrail", "les vitraux")); + $("#text-info-vitraux2").text(getItemText(nbItems, "le", "les")); + } + }); +} diff --git a/assets/js/partials/_main.js b/assets/js/partials/_main.js new file mode 100644 index 0000000..2a55809 --- /dev/null +++ b/assets/js/partials/_main.js @@ -0,0 +1,67 @@ +var getUrlParameter = function getUrlParameter(sParam) { + var sPageURL = decodeURIComponent(window.location.search.substring(1)), + sURLVariables = sPageURL.split('&'), + sParameterName, + i; + + for (i = 0; i < sURLVariables.length; i++) { + sParameterName = sURLVariables[i].split('='); + + if (sParameterName[0] === sParam) { + return sParameterName[1] === undefined ? true : sParameterName[1]; + } + } +}; + +var uniq = function (a) { + var seen = {}; + return a.filter(function (item) { + return seen.hasOwnProperty(item) ? false : (seen[item] = true); + }); +}; + +var getItemText = function (count, sing, plur) { + return (count === 1) ? sing : plur; +}; + +var getCourseDuration = function (total_min) { + var hours = Math.floor(total_min / 60); + var minutes = total_min % 60; + if (hours === 0) { + if (minutes === 0) { + return '0'; + } + return minutes + ' min'; + } else { + if (minutes === 0) { + return hours + ' h'; + } + return hours + 'h' + minutes; + } +}; + +var checkPage = function () { + var page = $('div.content').attr('id'); + switch (page) { + case 'courses': + initList(); + getCoursesList(); + break; + case 'map-page': + initialize(); + getCourseMap(); + break; + case 'explore-page': + getLocationVitraux(); + break; + case 'preview-page': + getVitrailId(); + break; + case 'description-page': + getDescription(); + break; + } +}; + +window.addEventListener('push', checkPage); +$(document).ready(checkPage); diff --git a/assets/js/partials/_map.js b/assets/js/partials/_map.js new file mode 100644 index 0000000..c94b081 --- /dev/null +++ b/assets/js/partials/_map.js @@ -0,0 +1,94 @@ +var google; +var map; +var initialize; +var calculate; +var direction; +var waypoints = []; + +function getCourseMap() { + var viewpoint = getUrlParameter('viewpoint'); + var topic = getUrlParameter('topic'); + + var topicids = []; + var spatial = []; + $.ajax({ + url: 'http://argos2.hypertopic.org/topic/' + viewpoint + '/' + topic, + dataType: 'json', + success: function (data) { + $.each(data.rows, function (index, r) { + if (r.value.item) { + topicids.push(r.value.item.id); + } else if (r.value.name) { + $('.title').text('Parcours' + ' "' + r.value.name + '"'); + } + }); + $.ajax({ + url: 'http://argos2.hypertopic.org/corpus/Vitraux - Bénel', + dataType: 'json', + success: function (data) { + $.each(data.rows, function (index, s) { + if (s.value.spatial && topicids.indexOf(s.key[1]) !== -1 && spatial.indexOf(s.value.spatial) === -1) { + spatial.push(s.value.spatial); + + $('.table-view').append('
  • ' + s.value.spatial + '
  • '); + if (s.value.spatial === "Église Saint-Remi, Troyes" || s.value.spatial === "Église Saint-Remy, Troyes") { + s.value.spatial = "3 Place Saint-Remi 10000 Troyes"; + } + + var troyes = new google.maps.LatLng(48.2973725, 4.0721523); + var request = { + location: troyes, + radius: '500', + query: s.value.spatial + }; + service = new google.maps.places.PlacesService(map); + service.textSearch(request, callback); + } + }); + } + }); + } + }); +} + +function callback(results, status) { + if (status === google.maps.places.PlacesServiceStatus.OK) { + var place = results[0]; + waypoints.push({ + location: place.formatted_address, + stopover: true + }); + calculate(waypoints[0].location, waypoints[waypoints.length - 1].location, waypoints); + } +} + +function initialize() { + var latLng = new google.maps.LatLng(48.2973725, 4.0721523); // Troyes + var myOptions = { + zoom: 14, // Zoom par défaut + center: latLng, // Coordonnées de départ de la carte de type latLng + mapTypeId: google.maps.MapTypeId.TERRAIN, + maxZoom: 20 + }; + + map = new google.maps.Map(document.getElementById('map'), myOptions); + + direction = new google.maps.DirectionsRenderer({ + map: map + }); +} + +function calculate(origin, destination, waypoints) { + var request = { + origin: origin, + destination: destination, + waypoints: waypoints, + travelMode: google.maps.DirectionsTravelMode.WALKING // A pied + }; + var directionsService = new google.maps.DirectionsService(); + directionsService.route(request, function (response, status) { // Envoie de la requête pour calculer le parcours + if (status === google.maps.DirectionsStatus.OK) { + direction.setDirections(response); // Trace l'itinéraire sur la carte + } + }); +} diff --git a/assets/js/partials/_preview.js b/assets/js/partials/_preview.js new file mode 100644 index 0000000..13eabd9 --- /dev/null +++ b/assets/js/partials/_preview.js @@ -0,0 +1,33 @@ +function getVitrailId() { + var id = getUrlParameter("id"); + var topic = getUrlParameter("topic"); + var viewpoint = getUrlParameter("viewpoint"); + var spatial = getUrlParameter("spatial"); + + $.ajax({ + url: 'http://steatite.hypertopic.org/corpus/Vitraux - Bénel', + dataType: 'json', + success: function (data) { + $.each(data.rows, function (index, s) { + if (s.value.resource && s.key[1] === id) { + $('.preview-img').attr('src', s.value.resource); + $('#found-btn').attr('onclick', 'found("' + id + '","' + spatial + '","' + topic + '","' + viewpoint + '")'); + $('#back').attr('href', 'explore.html?topic=' + topic + '&viewpoint=' + viewpoint + '&spatial=' + spatial); + } + if (s.value.name) { + if (s.key[1] === id) { + $(".title").text(s.value.name); + } + } + }); + } + }); + if (localStorage.getItem(id)) { + $('#found-btn').text("Description"); + } +} + +function found(id, spatial, topic, viewpoint) { + localStorage.setItem(id, true); + PUSH({url: 'description.html?id=' + id + '&' + 'topic=' + topic + '&viewpoint=' + viewpoint + '&spatial=' + spatial, transition: 'slide-in'}); +} diff --git a/assets/js/vitraux-visiteurs.min.js b/assets/js/vitraux-visiteurs.min.js new file mode 100644 index 0000000..6de5c69 --- /dev/null +++ b/assets/js/vitraux-visiteurs.min.js @@ -0,0 +1 @@ +function initList(){var a={valueNames:["course-title","course-vp","distance","locations","duration","items-nb",{data:["id"]},{attr:"href",name:"topic-link"}],item:'
  • km

  • '};courseList=new List("courses",a)}function getCoursesList(){var a=[{id:"56e092d8a6179a788c74b618b29801c0",name:"Histoire des religions"},{id:"a76306e4f17ed4f79e7e481eb9a1bd06",name:"Histoire de l'art"}];$.ajax({type:"GET",url:"http://argos2.hypertopic.org/corpus/Vitraux - Bénel",dataType:"json",success:function(b){$.each(a,function(a,c){$.ajax({type:"GET",url:"http://argos2.hypertopic.org/viewpoint/"+c.id,dataType:"json",success:function(a){$.each(a.rows,function(a,d){var e="",f="",g=[],h=[],i="";if(d.value.narrower){$("#courses-num").text(parseInt($("#courses-num").text())+1),e=d.value.narrower.name,f=d.value.narrower.id,i="map.html?viewpoint="+c.id+"&topic="+f,courseList.add({id:f,"course-title":'Parcours "'+e+'"',"course-vp":"— "+c.name,distance:"0",locations:"0 Lieux",duration:"0","items-nb":"0 Vitraux"});var j=courseList.get("id",f)[0];j.values({"topic-link":i}),$.each(b.rows,function(a,b){if(b.value.topic&&b.value.topic.viewpoint===c.id&&b.value.topic.id===f){g.push(b.id);var d=parseInt(j.values()["items-nb"].replace(/^\D+/g,""))+1;j.values({"items-nb":d+" "+getItemText(d,"Vitrail","Vitraux")})}}),$.each(b.rows,function(a,b){b.value.spatial&&$.inArray(b.id,g)>-1&&h.push(b.value.spatial)}),h=uniq(h);var k=h.length,l=getCourseDuration(30*k);j.values({locations:k+" "+getItemText(k,"Lieu","Lieux"),duration:l})}})}})})}})}function getCourseMap(){var a=getUrlParameter("viewpoint"),b=getUrlParameter("topic"),c=[],d=[];$.ajax({url:"http://argos2.hypertopic.org/topic/"+a+"/"+b,dataType:"json",success:function(e){$.each(e.rows,function(a,b){b.value.item?c.push(b.value.item.id):b.value.name&&$(".title").text('Parcours "'+b.value.name+'"')}),$.ajax({url:"http://argos2.hypertopic.org/corpus/Vitraux - Bénel",dataType:"json",success:function(e){$.each(e.rows,function(e,f){if(f.value.spatial&&-1!==c.indexOf(f.key[1])&&-1===d.indexOf(f.value.spatial)){d.push(f.value.spatial),$(".table-view").append('
  • '+f.value.spatial+"
  • "),"Église Saint-Remi, Troyes"!==f.value.spatial&&"Église Saint-Remy, Troyes"!==f.value.spatial||(f.value.spatial="3 Place Saint-Remi 10000 Troyes");var g=new google.maps.LatLng(48.2973725,4.0721523),h={location:g,radius:"500",query:f.value.spatial};service=new google.maps.places.PlacesService(map),service.textSearch(h,callback)}})}})}})}function callback(a,b){if(b===google.maps.places.PlacesServiceStatus.OK){var c=a[0];waypoints.push({location:c.formatted_address,stopover:!0}),calculate(waypoints[0].location,waypoints[waypoints.length-1].location,waypoints)}}function initialize(){var a=new google.maps.LatLng(48.2973725,4.0721523),b={zoom:14,center:a,mapTypeId:google.maps.MapTypeId.TERRAIN,maxZoom:20};map=new google.maps.Map(document.getElementById("map"),b),direction=new google.maps.DirectionsRenderer({map:map})}function calculate(a,b,c){var d={origin:a,destination:b,waypoints:c,travelMode:google.maps.DirectionsTravelMode.WALKING},e=new google.maps.DirectionsService;e.route(d,function(a,b){b===google.maps.DirectionsStatus.OK&&direction.setDirections(a)})}function getLocationVitraux(){if(void 0!==getUrlParameter("viewpoint"))var a=getUrlParameter("viewpoint"),b=getUrlParameter("topic"),c=decodeURIComponent(getUrlParameter("spatial"));$("#back").attr("href","map.html?+&viewpoint="+a+"&topic="+b),$(".place-name").text(c),$.ajax({url:"http://argos2.hypertopic.org/topic/"+a+"/"+b,dataType:"json",success:function(d){$.each(d.rows,function(d,e){if(e.value.item&&"Vitraux - Bénel"===e.value.item.corpus){var f="",g="none";e.value.item.name&&"Sans nom"!==e.value.item.name&&(f=e.value.item.name);var h=e.value.item.id,i="preview.html?id="+h+"&topic="+b+"&viewpoint="+a+"&spatial="+c;localStorage.getItem(h)&&(g="inline",i="description.html?id="+h+"&topic="+b+"&viewpoint="+a+"&spatial="+c);var j='
  • '+f+'

    '+f+'
  • ';$("#stainted-glass-windows").append(j)}else e.value.name&&$(".title").text('Parcours "'+e.value.name+'"')})}}),$.ajax({url:"http://steatite.hypertopic.org/corpus/Vitraux - Bénel",dataType:"json",success:function(a){$.each(a.rows,function(a,b){b.value.thumbnail&&$("#"+b.key[1]).find("img").attr("src",b.value.thumbnail),b.value.name&&($("#"+b.key[1]).find(".stained-glass-name").text(b.value.name),$("#"+b.key[1]).find("img").attr("alt",b.value.name))})}}),$.ajax({url:"http://argos2.hypertopic.org/corpus/Vitraux - Bénel",dataType:"json",success:function(a){$.each(a.rows,function(a,b){if(b.value.spatial&&b.value.spatial!==c){var d=$("#"+b.key[1]);d.length&&d.remove()}});var b=$("#stainted-glass-windows li").length-1;$("#text-info-vitraux1").text(getItemText(b,"le vitrail","les vitraux")),$("#text-info-vitraux2").text(getItemText(b,"le","les"))}})}function getVitrailId(){var a=getUrlParameter("id"),b=getUrlParameter("topic"),c=getUrlParameter("viewpoint"),d=getUrlParameter("spatial");$.ajax({url:"http://steatite.hypertopic.org/corpus/Vitraux - Bénel",dataType:"json",success:function(e){$.each(e.rows,function(e,f){f.value.resource&&f.key[1]===a&&($(".preview-img").attr("src",f.value.resource),$("#found-btn").attr("onclick",'found("'+a+'","'+d+'","'+b+'","'+c+'")'),$("#back").attr("href","explore.html?topic="+b+"&viewpoint="+c+"&spatial="+d)),f.value.name&&f.key[1]===a&&$(".title").text(f.value.name)})}}),localStorage.getItem(a)&&$("#found-btn").text("Description")}function found(a,b,c,d){localStorage.setItem(a,!0),PUSH({url:"description.html?id="+a+"&topic="+c+"&viewpoint="+d+"&spatial="+b,transition:"slide-in"})}function getDescription(){var a=getUrlParameter("id"),b=getUrlParameter("spatial"),c=getUrlParameter("viewpoint"),d=getUrlParameter("topic");$("#back").attr("href","explore.html?topic="+d+"&viewpoint="+c+"&spatial="+b),$.ajax({url:"http://steatite.hypertopic.org/corpus/Vitraux - Bénel",type:"GET",dataType:"json",success:function(b){var c,d,e;$.each(b.rows,function(b,f){f.key[1]===a&&(f.value.name?c=f.value.name:f.value.thumbnail?d=f.value.thumbnail:f.value.resource&&(e=f.value.resource))}),$(".title").text(c),$("#vitrailModal").find(".title").text(c+" [Zoom]"),$("#vitrailModal").find("a.btn").attr("href",e),$("#vitrail-thumbnail").find("img").attr("src",d),$("#vitrail-thumbnail").find("img").attr("alt",c),$("#vitrail-resource").attr("src",e),$("#vitrail-resource").attr("alt",c)}})}var getUrlParameter=function(a){var b,c,d=decodeURIComponent(window.location.search.substring(1)),e=d.split("&");for(c=0;c + + + Vitraux Visiteurs + + + + + + + + + + + + +
    +

    Vitraux Visiteurs 0

    +
    +
    + +
      +
      + + + + + + + diff --git a/description.html b/description.html new file mode 100644 index 0000000..0f11c22 --- /dev/null +++ b/description.html @@ -0,0 +1,53 @@ + + + + + Vitraux Visiteurs | En savoir plus + + + + + + + + + + + +
      +
      + +

      +
      +
      + +
      +
      + + + Vitrail Thumbnail + + +
      +

      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim

      + +
      + + + + + + diff --git a/explore.html b/explore.html new file mode 100644 index 0000000..c2d1b39 --- /dev/null +++ b/explore.html @@ -0,0 +1,33 @@ + + + + + Vitraux Visiteurs | Parcours de l'église + + + + + + + + + + + +
      + +

      +
      +
      +
        +
      • +

        +

        Appuyez pour agrandir ci-dessous et cherchez dans l'église pour en savoir plus !

        +
      • +
      +
      + + + + + diff --git a/index.html b/index.html deleted file mode 100644 index 48dc139..0000000 --- a/index.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - -

      Vitraux de Troyes

      -

      Parcours ""

      - - - - diff --git a/map.html b/map.html new file mode 100644 index 0000000..e3ac03b --- /dev/null +++ b/map.html @@ -0,0 +1,38 @@ + + + + Vitraux Visiteurs | Map + + + + + + + + + + + + + +
      + +

      +
      +
      +
      +

      Veuillez patienter pendant le chargement de la carte...

      +
      +
      +
        +
        +
        + + + + + + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..527d7f6 --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "name": "Vitraux-Visiteurs", + "version": "0.1.0", + "devDependencies": { + "grunt": "^1.0.1", + "grunt-contrib-uglify": "^1.0.1" + } +} diff --git a/preview.html b/preview.html new file mode 100644 index 0000000..5211105 --- /dev/null +++ b/preview.html @@ -0,0 +1,28 @@ + + + + + Vitraux Visiteurs | Preview + + + + + + + + + + +
        + +

        +
        + + + + + + diff --git a/test/def.rb b/test/def.rb new file mode 100644 index 0000000..a624dd1 --- /dev/null +++ b/test/def.rb @@ -0,0 +1,19 @@ +def isParcoursListComplete?() + has_css?(".search-bar") + has_css?(".table-view list") + isParcoursButtonHomepageComplete?(#first(".table-view list")) +end + +def isParcoursButtonHomepageComplete?(parcoursButton) + parcoursButton.has_css?(".course-title") + parcoursButton.has_css?(".course-abstract") +end + + +def isParcoursPreviewComplete?(Title) + expect(page).to have_content Title + expect(page).to have_content 'maps' + expect(page).to have_content 'Description :' + expect(page).to have_content 'Avis :' + expect(page).to have_content 'Démarrer' +end diff --git a/test/en_savoir_plus_sur_un_vitrail.rb b/test/en_savoir_plus_sur_un_vitrail.rb new file mode 100644 index 0000000..7d0d801 --- /dev/null +++ b/test/en_savoir_plus_sur_un_vitrail.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +feature 'En savoir plus sur un vitrail qui se trouve devant moi' do + + scenario 'Pour un parcours suivi : Parcours Moïse' do + listEglises 'Parcours Moïse' + expect(page).to have_content 'Église Saint Nizier' + click_on 'Église Saint-Nizier' + listVitraux 'Église Saint Nizier' + expect(page).to have_content 'Buisson Ardent' + click_on 'Buisson Ardent' + click_on 'J\'ai vu' + visit '/details-BuissonArdent' + end + + scenario 'Pour un vitrail isolé : Buisson Ardent' do + expect(page).to have_content 'Rechercher un thème, une époque, une église...' + fill_in 'search-course', :with => 'Saint Nizier' + expect(page).to have_content 'Église Saint Nizier' + click_on 'Église Saint-Nizier' + listVitraux 'Église Saint Nizier' + expect(page).to have_content 'Buisson Ardent' + click_on 'Buisson Ardent' + click_on 'J\'ai vu' + visit '/details-BuissonArdent' + end + +end diff --git a/test/spec_helper.rb b/test/spec_helper.rb new file mode 100644 index 0000000..6012bcf --- /dev/null +++ b/test/spec_helper.rb @@ -0,0 +1,37 @@ +require 'capybara/rspec' +require 'capybara/poltergeist' + +Capybara.run_server = false +Capybara.default_driver = :poltergeist +Capybara.app_host = "#" + +$home_page = '/' + +def isParcoursListComplete?() + has_css?(".search-bar") + has_css?(".table-view list") + isParcoursButtonHomepageComplete?(#first(".table-view list")) +end + +def isParcoursButtonHomepageComplete?(parcoursButton) + parcoursButton.has_css?(".course-title") + parcoursButton.has_css?(".course-abstract") +end + + +def isParcoursPreviewComplete?(Title) + expect(page).to have_content Title + expect(page).to have_content 'maps' + expect(page).to have_content 'Description :' + expect(page).to have_content 'Avis :' + expect(page).to have_content 'Démarrer' +end + +def listEglises(Parcours) + expect(page).to have_content 'Églises :' +end + +def listVitraux(Eglise) + expect(page).to have_content 'Vitraux :' +end + diff --git a/test/suivreParcoursTest.rb b/test/suivreParcoursTest.rb new file mode 100644 index 0000000..ef0b2e1 --- /dev/null +++ b/test/suivreParcoursTest.rb @@ -0,0 +1,29 @@ +require 'def' + +feature 'Suivre parcours' do + + scenario 'Choisir Parcours' do + visit $home_page + click_on ('Parcours "Moïse"') + isParcoursPreviewComplete?('Parcours "Moïse"') + end + + scenario 'Recherche Par Nom Du Parcours' do + visit $home_page + expect(page).to have_content 'Rechercher un thème, une époque...' + fill_in 'search-course', :with => 'Moïse' + expect(page).to have_content 'Parcours "Moïse"' + + end + + scenario 'Recherche Par Nombre de Vitraux' do + visit $home_page + expect(page).to have_content 'Rechercher un thème, une époque...' + fill_in 'search-course', :with =>'15' + expect(page).to have_content 'Parcours "Technique Narrative"' + + end + + + +end