Просмотр исходного кода

Merge branch 'BaseProject' into Sync

Iñigo Valentin 9 лет назад
Родитель
Сommit
3a556a6413
66 измененных файлов с 4464 добавлено и 61 удалено
  1. 112 12
      app.xcodeproj/project.pbxproj
  2. 172 0
      app/AlbumViewController.swift
  3. 3 0
      app/AppDelegate.swift
  4. 6 0
      app/Assets.xcassets/Social/Contents.json
  5. 23 0
      app/Assets.xcassets/Social/Facebook.imageset/Contents.json
  6. BIN
      app/Assets.xcassets/Social/Facebook.imageset/social_facebook-1.png
  7. BIN
      app/Assets.xcassets/Social/Facebook.imageset/social_facebook-2.png
  8. BIN
      app/Assets.xcassets/Social/Facebook.imageset/social_facebook.png
  9. 23 0
      app/Assets.xcassets/Social/GooglePlus.imageset/Contents.json
  10. BIN
      app/Assets.xcassets/Social/GooglePlus.imageset/social_googleplus-1.png
  11. BIN
      app/Assets.xcassets/Social/GooglePlus.imageset/social_googleplus-2.png
  12. BIN
      app/Assets.xcassets/Social/GooglePlus.imageset/social_googleplus.png
  13. 23 0
      app/Assets.xcassets/Social/Instagram.imageset/Contents.json
  14. BIN
      app/Assets.xcassets/Social/Instagram.imageset/social_instagram-1.png
  15. BIN
      app/Assets.xcassets/Social/Instagram.imageset/social_instagram-2.png
  16. BIN
      app/Assets.xcassets/Social/Instagram.imageset/social_instagram.png
  17. 23 0
      app/Assets.xcassets/Social/Mail.imageset/Contents.json
  18. BIN
      app/Assets.xcassets/Social/Mail.imageset/social_mail-1.png
  19. BIN
      app/Assets.xcassets/Social/Mail.imageset/social_mail-2.png
  20. BIN
      app/Assets.xcassets/Social/Mail.imageset/social_mail.png
  21. 23 0
      app/Assets.xcassets/Social/Phone.imageset/Contents.json
  22. BIN
      app/Assets.xcassets/Social/Phone.imageset/social_phone-1.png
  23. BIN
      app/Assets.xcassets/Social/Phone.imageset/social_phone-2.png
  24. BIN
      app/Assets.xcassets/Social/Phone.imageset/social_phone.png
  25. 23 0
      app/Assets.xcassets/Social/Twitter.imageset/Contents.json
  26. BIN
      app/Assets.xcassets/Social/Twitter.imageset/social_twitter-1.png
  27. BIN
      app/Assets.xcassets/Social/Twitter.imageset/social_twitter-2.png
  28. BIN
      app/Assets.xcassets/Social/Twitter.imageset/social_twitter.png
  29. 23 0
      app/Assets.xcassets/Social/Whatsapp.imageset/Contents.json
  30. BIN
      app/Assets.xcassets/Social/Whatsapp.imageset/social_whatsapp-1.png
  31. BIN
      app/Assets.xcassets/Social/Whatsapp.imageset/social_whatsapp-2.png
  32. BIN
      app/Assets.xcassets/Social/Whatsapp.imageset/social_whatsapp.png
  33. 23 0
      app/Assets.xcassets/Social/Youtube.imageset/Contents.json
  34. BIN
      app/Assets.xcassets/Social/Youtube.imageset/social_youtube-1.png
  35. BIN
      app/Assets.xcassets/Social/Youtube.imageset/social_youtube-2.png
  36. BIN
      app/Assets.xcassets/Social/Youtube.imageset/social_youtube.png
  37. 405 11
      app/Base.lproj/Main.storyboard
  38. 203 0
      app/BlogView.swift
  39. 61 0
      app/BlogView.xib
  40. 187 0
      app/GalleryView.swift
  41. 62 0
      app/GalleryView.xib
  42. 212 5
      app/HomeView.swift
  43. 18 18
      app/HomeView.xib
  44. 194 0
      app/LablancaView.swift
  45. 407 0
      app/LablancaView.xib
  46. 158 0
      app/PostViewController.swift
  47. 130 0
      app/RowAlbum.swift
  48. 81 0
      app/RowAlbum.xib
  49. 130 0
      app/RowBlog.swift
  50. 113 0
      app/RowBlog.xib
  51. 132 0
      app/RowGallery.swift
  52. 152 0
      app/RowGallery.xib
  53. 120 0
      app/RowHomeBlog.swift
  54. 111 0
      app/RowHomeBlog.xib
  55. 118 0
      app/RowHomeFutureActivities.swift
  56. 111 0
      app/RowHomeFutureActivities.xib
  57. 102 0
      app/RowHomeGallery.swift
  58. 112 0
      app/RowHomeGallery.xib
  59. 151 0
      app/RowHomeSocial.swift
  60. 155 0
      app/RowHomeSocial.xib
  61. 89 0
      app/RowLablancaDay.swift
  62. 102 0
      app/RowLablancaDay.xib
  63. 42 0
      app/UIApplcation.swift
  64. 66 6
      app/UIImageView.swift
  65. 16 0
      app/UIView.swift
  66. 47 9
      app/ViewController.swift

+ 112 - 12
app.xcodeproj/project.pbxproj

@@ -7,20 +7,45 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		93075C6A1E59CAB000396389 /* BlogView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93075C691E59CAB000396389 /* BlogView.xib */; };
+		93075C6C1E59CB6B00396389 /* BlogView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93075C6B1E59CB6B00396389 /* BlogView.swift */; };
+		93075C701E59D04A00396389 /* RowBlog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93075C6F1E59D04A00396389 /* RowBlog.swift */; };
+		93075C721E59D06900396389 /* RowBlog.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93075C711E59D06900396389 /* RowBlog.xib */; };
 		931AA5891E1AFF8C003A2290 /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 931AA5881E1AFF8C003A2290 /* String.swift */; };
 		931AA58B1E1DA911003A2290 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 931AA58A1E1DA910003A2290 /* CoreData.framework */; };
 		931AA5AE1E218D0E003A2290 /* Entry.xib in Resources */ = {isa = PBXBuildFile; fileRef = 931AA5AD1E218D0D003A2290 /* Entry.xib */; };
 		931AA5B01E219006003A2290 /* RowHomePastActivities.xib in Resources */ = {isa = PBXBuildFile; fileRef = 931AA5AF1E219006003A2290 /* RowHomePastActivities.xib */; };
+		9326C4F41EA51C39007DF2A4 /* RowLablancaDay.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9326C4F31EA51C39007DF2A4 /* RowLablancaDay.xib */; };
+		9326C4F61EA5279D007DF2A4 /* RowLablancaDay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9326C4F51EA5279D007DF2A4 /* RowLablancaDay.swift */; };
 		93294FF81E336FA000FDAF50 /* Entry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93294FF71E336FA000FDAF50 /* Entry.swift */; };
 		93294FFA1E337D0D00FDAF50 /* RowHomePastActivities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93294FF91E337D0D00FDAF50 /* RowHomePastActivities.swift */; };
 		935892D01E493C2300E1CD5F /* UIImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 935892CF1E493C2300E1CD5F /* UIImageView.swift */; };
+		935D6E2D1E8678B700CED3A1 /* GalleryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 935D6E2C1E8678B700CED3A1 /* GalleryView.xib */; };
+		935D6E2F1E86792000CED3A1 /* GalleryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 935D6E2E1E86792000CED3A1 /* GalleryView.swift */; };
+		935D6E311E867C5E00CED3A1 /* RowGallery.xib in Resources */ = {isa = PBXBuildFile; fileRef = 935D6E301E867C5E00CED3A1 /* RowGallery.xib */; };
+		935D6E331E867C7E00CED3A1 /* RowGallery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 935D6E321E867C7E00CED3A1 /* RowGallery.swift */; };
+		936966ED1E98445200A11055 /* AlbumViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 936966EC1E98445200A11055 /* AlbumViewController.swift */; };
+		936966EF1E9848D600A11055 /* RowAlbum.xib in Resources */ = {isa = PBXBuildFile; fileRef = 936966EE1E9848D600A11055 /* RowAlbum.xib */; };
+		936966F11E984B5000A11055 /* RowAlbum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 936966F01E984B5000A11055 /* RowAlbum.swift */; };
+		937EA02D1E5B8B5300D0893A /* UIApplcation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 937EA02C1E5B8B5300D0893A /* UIApplcation.swift */; };
+		938D211D1EA2275300C47EC3 /* LablancaView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 938D211C1EA2275300C47EC3 /* LablancaView.xib */; };
+		938D211F1EA2306300C47EC3 /* LablancaView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 938D211E1EA2306300C47EC3 /* LablancaView.swift */; };
 		93B408031D9ED44C000FBC99 /* MenuCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93B408021D9ED44C000FBC99 /* MenuCollectionViewCell.swift */; };
+		93B5C01A1E872B4B0069BFF8 /* RowHomeGallery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93B5C0191E872B4B0069BFF8 /* RowHomeGallery.swift */; };
+		93B5C01C1E872B600069BFF8 /* RowHomeGallery.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93B5C01B1E872B600069BFF8 /* RowHomeGallery.xib */; };
 		93B84B9A1D9C31AB006C0F67 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93B84B991D9C31AB006C0F67 /* AppDelegate.swift */; };
 		93B84B9C1D9C31AB006C0F67 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93B84B9B1D9C31AB006C0F67 /* ViewController.swift */; };
 		93B84B9F1D9C31AB006C0F67 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 93B84B9D1D9C31AB006C0F67 /* Main.storyboard */; };
 		93B84BA21D9C31AB006C0F67 /* app.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 93B84BA01D9C31AB006C0F67 /* app.xcdatamodeld */; };
 		93B84BA41D9C31AB006C0F67 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 93B84BA31D9C31AB006C0F67 /* Assets.xcassets */; };
 		93B84BA71D9C31AB006C0F67 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 93B84BA51D9C31AB006C0F67 /* LaunchScreen.storyboard */; };
+		93BAD2EE1E585578009DF853 /* RowHomeBlog.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93BAD2ED1E585578009DF853 /* RowHomeBlog.xib */; };
+		93BAD2F01E585662009DF853 /* RowHomeBlog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BAD2EF1E585662009DF853 /* RowHomeBlog.swift */; };
+		93BAD2F21E585E88009DF853 /* RowHomeFutureActivities.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93BAD2F11E585E88009DF853 /* RowHomeFutureActivities.xib */; };
+		93BAD2F41E585EE6009DF853 /* RowHomeFutureActivities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BAD2F31E585EE6009DF853 /* RowHomeFutureActivities.swift */; };
+		93BAD2F61E586310009DF853 /* RowHomeSocial.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93BAD2F51E586310009DF853 /* RowHomeSocial.xib */; };
+		93BAD2F81E586741009DF853 /* RowHomeSocial.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BAD2F71E586741009DF853 /* RowHomeSocial.swift */; };
+		93BEB6D21E7E878300C68DE5 /* PostViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BEB6D11E7E878300C68DE5 /* PostViewController.swift */; };
 		93D9EA601DE271E700089002 /* Section.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93D9EA5F1DE271E700089002 /* Section.xib */; };
 		93D9EA641DE273FD00089002 /* Section.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93D9EA631DE273FD00089002 /* Section.swift */; };
 		93D9EA681DE342AC00089002 /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93D9EA671DE342AC00089002 /* UIView.swift */; };
@@ -31,14 +56,32 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
+		93075C691E59CAB000396389 /* BlogView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BlogView.xib; sourceTree = "<group>"; };
+		93075C6B1E59CB6B00396389 /* BlogView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlogView.swift; sourceTree = "<group>"; };
+		93075C6F1E59D04A00396389 /* RowBlog.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowBlog.swift; sourceTree = "<group>"; };
+		93075C711E59D06900396389 /* RowBlog.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowBlog.xib; sourceTree = "<group>"; };
 		931AA5881E1AFF8C003A2290 /* String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = String.swift; sourceTree = "<group>"; };
 		931AA58A1E1DA910003A2290 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
 		931AA5AD1E218D0D003A2290 /* Entry.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Entry.xib; sourceTree = "<group>"; };
 		931AA5AF1E219006003A2290 /* RowHomePastActivities.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowHomePastActivities.xib; sourceTree = "<group>"; };
+		9326C4F31EA51C39007DF2A4 /* RowLablancaDay.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowLablancaDay.xib; sourceTree = "<group>"; };
+		9326C4F51EA5279D007DF2A4 /* RowLablancaDay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowLablancaDay.swift; sourceTree = "<group>"; };
 		93294FF71E336FA000FDAF50 /* Entry.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Entry.swift; sourceTree = "<group>"; };
 		93294FF91E337D0D00FDAF50 /* RowHomePastActivities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowHomePastActivities.swift; sourceTree = "<group>"; };
 		935892CF1E493C2300E1CD5F /* UIImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIImageView.swift; sourceTree = "<group>"; };
+		935D6E2C1E8678B700CED3A1 /* GalleryView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = GalleryView.xib; sourceTree = "<group>"; };
+		935D6E2E1E86792000CED3A1 /* GalleryView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GalleryView.swift; sourceTree = "<group>"; };
+		935D6E301E867C5E00CED3A1 /* RowGallery.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowGallery.xib; sourceTree = "<group>"; };
+		935D6E321E867C7E00CED3A1 /* RowGallery.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowGallery.swift; sourceTree = "<group>"; };
+		936966EC1E98445200A11055 /* AlbumViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlbumViewController.swift; sourceTree = "<group>"; };
+		936966EE1E9848D600A11055 /* RowAlbum.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowAlbum.xib; sourceTree = "<group>"; };
+		936966F01E984B5000A11055 /* RowAlbum.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowAlbum.swift; sourceTree = "<group>"; };
+		937EA02C1E5B8B5300D0893A /* UIApplcation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIApplcation.swift; sourceTree = "<group>"; };
+		938D211C1EA2275300C47EC3 /* LablancaView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LablancaView.xib; sourceTree = "<group>"; };
+		938D211E1EA2306300C47EC3 /* LablancaView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LablancaView.swift; sourceTree = "<group>"; };
 		93B408021D9ED44C000FBC99 /* MenuCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MenuCollectionViewCell.swift; path = ../MenuCollectionViewCell.swift; sourceTree = "<group>"; };
+		93B5C0191E872B4B0069BFF8 /* RowHomeGallery.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowHomeGallery.swift; sourceTree = "<group>"; };
+		93B5C01B1E872B600069BFF8 /* RowHomeGallery.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowHomeGallery.xib; sourceTree = "<group>"; };
 		93B84B961D9C31AB006C0F67 /* app.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = app.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		93B84B991D9C31AB006C0F67 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
 		93B84B9B1D9C31AB006C0F67 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
@@ -47,6 +90,13 @@
 		93B84BA31D9C31AB006C0F67 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
 		93B84BA61D9C31AB006C0F67 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
 		93B84BA81D9C31AB006C0F67 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		93BAD2ED1E585578009DF853 /* RowHomeBlog.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowHomeBlog.xib; sourceTree = "<group>"; };
+		93BAD2EF1E585662009DF853 /* RowHomeBlog.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowHomeBlog.swift; sourceTree = "<group>"; };
+		93BAD2F11E585E88009DF853 /* RowHomeFutureActivities.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowHomeFutureActivities.xib; sourceTree = "<group>"; };
+		93BAD2F31E585EE6009DF853 /* RowHomeFutureActivities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowHomeFutureActivities.swift; sourceTree = "<group>"; };
+		93BAD2F51E586310009DF853 /* RowHomeSocial.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowHomeSocial.xib; sourceTree = "<group>"; };
+		93BAD2F71E586741009DF853 /* RowHomeSocial.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowHomeSocial.swift; sourceTree = "<group>"; };
+		93BEB6D11E7E878300C68DE5 /* PostViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PostViewController.swift; sourceTree = "<group>"; };
 		93D9EA5F1DE271E700089002 /* Section.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Section.xib; path = ../Section.xib; sourceTree = "<group>"; };
 		93D9EA631DE273FD00089002 /* Section.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Section.swift; sourceTree = "<group>"; };
 		93D9EA671DE342AC00089002 /* UIView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIView.swift; sourceTree = "<group>"; };
@@ -89,26 +139,51 @@
 		93B84B981D9C31AB006C0F67 /* app */ = {
 			isa = PBXGroup;
 			children = (
-				93B408021D9ED44C000FBC99 /* MenuCollectionViewCell.swift */,
-				93B84B9B1D9C31AB006C0F67 /* ViewController.swift */,
-				93B84B991D9C31AB006C0F67 /* AppDelegate.swift */,
-				93B84B9D1D9C31AB006C0F67 /* Main.storyboard */,
-				93B84BA31D9C31AB006C0F67 /* Assets.xcassets */,
-				93B84BA51D9C31AB006C0F67 /* LaunchScreen.storyboard */,
 				93B84BA81D9C31AB006C0F67 /* Info.plist */,
+				93B84BA31D9C31AB006C0F67 /* Assets.xcassets */,
 				93B84BA01D9C31AB006C0F67 /* app.xcdatamodeld */,
+				93B84BA51D9C31AB006C0F67 /* LaunchScreen.storyboard */,
+				93B84B991D9C31AB006C0F67 /* AppDelegate.swift */,
+				93B84B9D1D9C31AB006C0F67 /* Main.storyboard */,
+				93B84B9B1D9C31AB006C0F67 /* ViewController.swift */,
+				93B408021D9ED44C000FBC99 /* MenuCollectionViewCell.swift */,
+				93BEB6D11E7E878300C68DE5 /* PostViewController.swift */,
 				93D9EA5F1DE271E700089002 /* Section.xib */,
 				93D9EA631DE273FD00089002 /* Section.swift */,
 				931AA5AD1E218D0D003A2290 /* Entry.xib */,
 				93294FF71E336FA000FDAF50 /* Entry.swift */,
 				93D9EA6B1DE3498500089002 /* HomeView.xib */,
 				93D9EA691DE3491100089002 /* HomeView.swift */,
-				93D9EA751DE3ACBB00089002 /* Sync.swift */,
+				93BAD2F11E585E88009DF853 /* RowHomeFutureActivities.xib */,
+				93BAD2F31E585EE6009DF853 /* RowHomeFutureActivities.swift */,
+				93BAD2ED1E585578009DF853 /* RowHomeBlog.xib */,
+				93BAD2EF1E585662009DF853 /* RowHomeBlog.swift */,
 				931AA5AF1E219006003A2290 /* RowHomePastActivities.xib */,
 				93294FF91E337D0D00FDAF50 /* RowHomePastActivities.swift */,
+				93BAD2F51E586310009DF853 /* RowHomeSocial.xib */,
+				93BAD2F71E586741009DF853 /* RowHomeSocial.swift */,
+				93075C691E59CAB000396389 /* BlogView.xib */,
+				93075C6B1E59CB6B00396389 /* BlogView.swift */,
+				93075C711E59D06900396389 /* RowBlog.xib */,
+				93075C6F1E59D04A00396389 /* RowBlog.swift */,
+				93D9EA751DE3ACBB00089002 /* Sync.swift */,
 				931AA5881E1AFF8C003A2290 /* String.swift */,
 				93D9EA671DE342AC00089002 /* UIView.swift */,
 				935892CF1E493C2300E1CD5F /* UIImageView.swift */,
+				937EA02C1E5B8B5300D0893A /* UIApplcation.swift */,
+				935D6E2C1E8678B700CED3A1 /* GalleryView.xib */,
+				935D6E2E1E86792000CED3A1 /* GalleryView.swift */,
+				935D6E301E867C5E00CED3A1 /* RowGallery.xib */,
+				935D6E321E867C7E00CED3A1 /* RowGallery.swift */,
+				93B5C0191E872B4B0069BFF8 /* RowHomeGallery.swift */,
+				93B5C01B1E872B600069BFF8 /* RowHomeGallery.xib */,
+				936966EC1E98445200A11055 /* AlbumViewController.swift */,
+				936966EE1E9848D600A11055 /* RowAlbum.xib */,
+				936966F01E984B5000A11055 /* RowAlbum.swift */,
+				938D211C1EA2275300C47EC3 /* LablancaView.xib */,
+				938D211E1EA2306300C47EC3 /* LablancaView.swift */,
+				9326C4F31EA51C39007DF2A4 /* RowLablancaDay.xib */,
+				9326C4F51EA5279D007DF2A4 /* RowLablancaDay.swift */,
 			);
 			path = app;
 			sourceTree = "<group>";
@@ -154,7 +229,7 @@
 				TargetAttributes = {
 					93B84B951D9C31AB006C0F67 = {
 						CreatedOnToolsVersion = 8.0;
-						DevelopmentTeam = Z2WQ2CQN52;
+						DevelopmentTeam = 9F9ER4X7TG;
 						ProvisioningStyle = Automatic;
 					};
 				};
@@ -183,12 +258,23 @@
 			buildActionMask = 2147483647;
 			files = (
 				931AA5AE1E218D0E003A2290 /* Entry.xib in Resources */,
+				938D211D1EA2275300C47EC3 /* LablancaView.xib in Resources */,
+				93075C721E59D06900396389 /* RowBlog.xib in Resources */,
 				93B84BA71D9C31AB006C0F67 /* LaunchScreen.storyboard in Resources */,
+				93BAD2F61E586310009DF853 /* RowHomeSocial.xib in Resources */,
+				93BAD2F21E585E88009DF853 /* RowHomeFutureActivities.xib in Resources */,
 				931AA5B01E219006003A2290 /* RowHomePastActivities.xib in Resources */,
+				936966EF1E9848D600A11055 /* RowAlbum.xib in Resources */,
 				93D9EA601DE271E700089002 /* Section.xib in Resources */,
+				93075C6A1E59CAB000396389 /* BlogView.xib in Resources */,
 				93B84BA41D9C31AB006C0F67 /* Assets.xcassets in Resources */,
+				935D6E2D1E8678B700CED3A1 /* GalleryView.xib in Resources */,
+				93BAD2EE1E585578009DF853 /* RowHomeBlog.xib in Resources */,
+				9326C4F41EA51C39007DF2A4 /* RowLablancaDay.xib in Resources */,
+				935D6E311E867C5E00CED3A1 /* RowGallery.xib in Resources */,
 				93B84B9F1D9C31AB006C0F67 /* Main.storyboard in Resources */,
 				93D9EA6C1DE3498500089002 /* HomeView.xib in Resources */,
+				93B5C01C1E872B600069BFF8 /* RowHomeGallery.xib in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -200,17 +286,31 @@
 			buildActionMask = 2147483647;
 			files = (
 				93294FF81E336FA000FDAF50 /* Entry.swift in Sources */,
+				937EA02D1E5B8B5300D0893A /* UIApplcation.swift in Sources */,
+				936966F11E984B5000A11055 /* RowAlbum.swift in Sources */,
 				93D9EA641DE273FD00089002 /* Section.swift in Sources */,
 				93D9EA6A1DE3491100089002 /* HomeView.swift in Sources */,
+				93BEB6D21E7E878300C68DE5 /* PostViewController.swift in Sources */,
+				93BAD2F81E586741009DF853 /* RowHomeSocial.swift in Sources */,
+				9326C4F61EA5279D007DF2A4 /* RowLablancaDay.swift in Sources */,
+				93BAD2F01E585662009DF853 /* RowHomeBlog.swift in Sources */,
 				93294FFA1E337D0D00FDAF50 /* RowHomePastActivities.swift in Sources */,
+				93B5C01A1E872B4B0069BFF8 /* RowHomeGallery.swift in Sources */,
 				935892D01E493C2300E1CD5F /* UIImageView.swift in Sources */,
 				93D9EA761DE3ACBB00089002 /* Sync.swift in Sources */,
+				93BAD2F41E585EE6009DF853 /* RowHomeFutureActivities.swift in Sources */,
 				931AA5891E1AFF8C003A2290 /* String.swift in Sources */,
 				93B84B9C1D9C31AB006C0F67 /* ViewController.swift in Sources */,
+				93075C6C1E59CB6B00396389 /* BlogView.swift in Sources */,
 				93B84B9A1D9C31AB006C0F67 /* AppDelegate.swift in Sources */,
 				93B84BA21D9C31AB006C0F67 /* app.xcdatamodeld in Sources */,
+				935D6E331E867C7E00CED3A1 /* RowGallery.swift in Sources */,
+				936966ED1E98445200A11055 /* AlbumViewController.swift in Sources */,
 				93D9EA681DE342AC00089002 /* UIView.swift in Sources */,
+				938D211F1EA2306300C47EC3 /* LablancaView.swift in Sources */,
+				93075C701E59D04A00396389 /* RowBlog.swift in Sources */,
 				93B408031D9ED44C000FBC99 /* MenuCollectionViewCell.swift in Sources */,
+				935D6E2F1E86792000CED3A1 /* GalleryView.swift in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -334,11 +434,11 @@
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				DEVELOPMENT_TEAM = Z2WQ2CQN52;
+				DEVELOPMENT_TEAM = 9F9ER4X7TG;
 				INFOPLIST_FILE = app/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 9.3;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				PRODUCT_BUNDLE_IDENTIFIER = com.margolariak.app;
+				PRODUCT_BUNDLE_IDENTIFIER = com.margolariak.iosapp;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_VERSION = 3.0;
 			};
@@ -349,11 +449,11 @@
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				DEVELOPMENT_TEAM = Z2WQ2CQN52;
+				DEVELOPMENT_TEAM = 9F9ER4X7TG;
 				INFOPLIST_FILE = app/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 9.3;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				PRODUCT_BUNDLE_IDENTIFIER = com.margolariak.app;
+				PRODUCT_BUNDLE_IDENTIFIER = com.margolariak.iosapp;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_VERSION = 3.0;
 			};

+ 172 - 0
app/AlbumViewController.swift

@@ -0,0 +1,172 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import UIKit
+import CoreData
+
+/**
+The view controller of the app.
+*/
+class AlbumViewController: UIViewController, UIGestureRecognizerDelegate {
+	
+	@IBOutlet weak var barButton: UIButton!
+	@IBOutlet weak var barTitle: UILabel!
+	@IBOutlet weak var albumTitle: UILabel!
+	@IBOutlet weak var albumContainer: UIStackView!
+	@IBOutlet weak var albumView: UIView!
+
+	// Album ID
+	var id: Int = -1
+	
+	// App delegate
+	var delegate: AppDelegate?
+	
+	// Id received from segue.
+	var passId: Int = -1
+	
+	func getContext () -> NSManagedObjectContext {
+		return NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
+	}
+	
+	/**
+	Run when the app loads.
+	*/
+	override func viewDidLoad() {
+		
+		NSLog(":ALBUMCONTROLLER:LOG: Init album.")
+		
+		super.viewDidLoad()
+		self.loadAlbum(id: id)
+		
+		// Set button action
+		barButton.addTarget(self, action: #selector(self.back), for: .touchUpInside)
+	}
+	
+	/**
+	Returns to the main view controller.
+	*/
+	func back() {
+		NSLog(":ALBUMCONTROLLER:DEBUG: Back")
+		self.dismiss(animated: true, completion: nil)
+	}
+	
+	
+	/**
+	Dispose of any resources that can be recreated.
+	*/
+	override func didReceiveMemoryWarning() {
+		super.didReceiveMemoryWarning()
+	}
+	
+	/**
+	Loads the photos of the album
+	*/
+	public func loadAlbum(id: Int){
+		
+		NSLog(":ALBUMCONTROLLER:DEBUG: Loading album \(id)")
+		
+		albumContainer.backgroundColor = UIColor.red
+		
+		var row : RowAlbum
+		
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let lang : String = getLanguage()
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		let fetchRequest: NSFetchRequest<Photo_album> = Photo_album.fetchRequest()
+		fetchRequest.predicate = NSPredicate(format: "album = %i", id)
+		
+		var rowcount = 0
+		
+		do {
+			
+			// Get the photo list
+			let searchResults = try context.fetch(fetchRequest)
+			var image: String
+			
+			NSLog(":GALLERYCONTROLLER:DEBUG: Total photos: \(searchResults.count)")
+			
+			for i in (0..<searchResults.count) where i % 2 == 0 {
+				
+				var r = searchResults[i]
+				var photoId = r.value(forKey: "photo")! as! Int
+				
+				row = RowAlbum.init(s: "rowAlbum\(i)", i: i)
+				
+				// Get photo info from Photo entity
+				let imgFetchRequest: NSFetchRequest<Photo> = Photo.fetchRequest()
+				let imgSortDescriptor = NSSortDescriptor(key: "uploaded", ascending: true)
+				let imgSortDescriptors = [imgSortDescriptor]
+				imgFetchRequest.sortDescriptors = imgSortDescriptors
+				imgFetchRequest.predicate = NSPredicate(format: "id == %i", photoId)
+				imgFetchRequest.fetchLimit = 1
+				do{
+					var imgSearchResults = try context.fetch(imgFetchRequest)
+					var imgR = imgSearchResults[0]
+					image = imgR.value(forKey: "file")! as! String
+					NSLog(":GALLERYCONTROLLER:LOG: Image Row \(i) left: \(image)")
+					row.setImage(idx: 0, filename: image)
+					if i + 1 < searchResults.count {
+						r = searchResults[i + 1]
+						photoId = r.value(forKey: "photo")! as! Int
+						imgFetchRequest.predicate = NSPredicate(format: "id == %i", photoId)
+						imgSearchResults = try context.fetch(imgFetchRequest)
+						
+						
+						imgR = imgSearchResults[0]
+						image = imgR.value(forKey: "file")! as! String
+						NSLog(":GALLERYCONTROLLER:LOG: Image Row \(i) right: \(image)")
+						row.setImage(idx: 1, filename: image)
+					}
+					else{
+						NSLog(":GALLERYCONTROLLER:LOG: Image Row \(i) right: none")
+					}
+					//TODO create row, add images (L+R), add row to container.
+					//row.setImage(filename: image)
+				} catch {
+					print(":GALLERYCONTROLLER:ERROR: Error getting image for post \(id): \(error)")
+				}
+				
+				NSLog(":GALLERYCONTROLLER:DEBUG: Adding row: height: \(row.frame.height)")
+				albumContainer.addArrangedSubview(row)
+				
+				rowcount = rowcount + 1
+			}
+		} catch {
+			print("POST:ERROR: Error with request: \(error)")
+		}
+	}
+	
+	/**
+	Gets the device language.
+	:return: Two letter language code of the device.
+	*/
+	func getLanguage() -> String{
+		let pre = NSLocale.preferredLanguages[0].subStr(start: 0, end: 1)
+		if(pre == "es" || pre == "en" || pre == "eu"){
+			return pre
+		}
+		else{
+			return "es"
+		}
+	}
+	
+}
+

+ 3 - 0
app/AppDelegate.swift

@@ -25,6 +25,8 @@ import CoreData
 class AppDelegate: UIResponder, UIApplicationDelegate {
 
 	var window: UIWindow?
+	
+	var controller: ViewController?
 
 	
 
@@ -120,5 +122,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 			}
 		}
 	}
+	
 }
 

+ 6 - 0
app/Assets.xcassets/Social/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

+ 23 - 0
app/Assets.xcassets/Social/Facebook.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "social_facebook.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_facebook-1.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_facebook-2.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
app/Assets.xcassets/Social/Facebook.imageset/social_facebook-1.png


BIN
app/Assets.xcassets/Social/Facebook.imageset/social_facebook-2.png


BIN
app/Assets.xcassets/Social/Facebook.imageset/social_facebook.png


+ 23 - 0
app/Assets.xcassets/Social/GooglePlus.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "social_googleplus.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_googleplus-1.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_googleplus-2.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
app/Assets.xcassets/Social/GooglePlus.imageset/social_googleplus-1.png


BIN
app/Assets.xcassets/Social/GooglePlus.imageset/social_googleplus-2.png


BIN
app/Assets.xcassets/Social/GooglePlus.imageset/social_googleplus.png


+ 23 - 0
app/Assets.xcassets/Social/Instagram.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "social_instagram.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_instagram-1.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_instagram-2.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
app/Assets.xcassets/Social/Instagram.imageset/social_instagram-1.png


BIN
app/Assets.xcassets/Social/Instagram.imageset/social_instagram-2.png


BIN
app/Assets.xcassets/Social/Instagram.imageset/social_instagram.png


+ 23 - 0
app/Assets.xcassets/Social/Mail.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "social_mail.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_mail-1.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_mail-2.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
app/Assets.xcassets/Social/Mail.imageset/social_mail-1.png


BIN
app/Assets.xcassets/Social/Mail.imageset/social_mail-2.png


BIN
app/Assets.xcassets/Social/Mail.imageset/social_mail.png


+ 23 - 0
app/Assets.xcassets/Social/Phone.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "social_phone.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_phone-1.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_phone-2.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
app/Assets.xcassets/Social/Phone.imageset/social_phone-1.png


BIN
app/Assets.xcassets/Social/Phone.imageset/social_phone-2.png


BIN
app/Assets.xcassets/Social/Phone.imageset/social_phone.png


+ 23 - 0
app/Assets.xcassets/Social/Twitter.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "social_twitter.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_twitter-1.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_twitter-2.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
app/Assets.xcassets/Social/Twitter.imageset/social_twitter-1.png


BIN
app/Assets.xcassets/Social/Twitter.imageset/social_twitter-2.png


BIN
app/Assets.xcassets/Social/Twitter.imageset/social_twitter.png


+ 23 - 0
app/Assets.xcassets/Social/Whatsapp.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "social_whatsapp.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_whatsapp-1.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_whatsapp-2.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
app/Assets.xcassets/Social/Whatsapp.imageset/social_whatsapp-1.png


BIN
app/Assets.xcassets/Social/Whatsapp.imageset/social_whatsapp-2.png


BIN
app/Assets.xcassets/Social/Whatsapp.imageset/social_whatsapp.png


+ 23 - 0
app/Assets.xcassets/Social/Youtube.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "social_youtube.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_youtube-1.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "social_youtube-2.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
app/Assets.xcassets/Social/Youtube.imageset/social_youtube-1.png


BIN
app/Assets.xcassets/Social/Youtube.imageset/social_youtube-2.png


BIN
app/Assets.xcassets/Social/Youtube.imageset/social_youtube.png


+ 405 - 11
app/Base.lproj/Main.storyboard

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16B2657" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
     <device id="retina4_0" orientation="portrait">
         <adaptation id="fullscreen"/>
     </device>
@@ -7,6 +7,7 @@
         <deployment identifier="iOS"/>
         <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
         <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
@@ -23,10 +24,10 @@
                 <placeholder placeholderIdentifier="IBFirstResponder" id="utt-1m-pei" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
         </scene>
-        <!--Gasteizko Margolariak-->
+        <!--GMViewController-->
         <scene sceneID="tne-QT-ifu">
             <objects>
-                <viewController title="Gasteizko Margolariak" id="BYZ-38-t0r" customClass="ViewController" customModule="app" customModuleProvider="target" sceneMemberID="viewController">
+                <viewController storyboardIdentifier="GMViewController" title="Gasteizko Margolariak" useStoryboardIdentifierAsRestorationIdentifier="YES" id="BYZ-38-t0r" userLabel="GMViewController" customClass="ViewController" customModule="app" customModuleProvider="target" sceneMemberID="viewController">
                     <layoutGuides>
                         <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
                         <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
@@ -63,7 +64,7 @@
                                 </collectionViewFlowLayout>
                                 <cells>
                                     <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="a4j-DF-epb" customClass="MenuCollectionViewCell" customModule="app" customModuleProvider="target">
-                                        <rect key="frame" x="0.0" y="-2.5" width="100" height="50"/>
+                                        <rect key="frame" x="0.0" y="-3" width="100" height="50"/>
                                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                         <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
                                             <rect key="frame" x="0.0" y="0.0" width="100" height="50"/>
@@ -184,6 +185,8 @@
                         <outlet property="containerViewHome" destination="FfD-xR-Ufj" id="EtF-qz-vWE"/>
                         <outlet property="containerViewLablanca" destination="nhy-Gy-cgq" id="bBa-2W-hjf"/>
                         <outlet property="containerViewLocation" destination="T4H-Rn-I4y" id="EFa-Km-WuR"/>
+                        <segue destination="UkS-wI-Yhx" kind="show" identifier="SeguePost" id="gs2-jd-cPW"/>
+                        <segue destination="k0M-Sk-DZM" kind="show" identifier="SegueAlbum" id="Puc-tv-vaD"/>
                     </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
@@ -234,10 +237,10 @@
                         <viewControllerLayoutGuide type="top" id="dmp-DU-HeF"/>
                         <viewControllerLayoutGuide type="bottom" id="cDH-sf-Urh"/>
                     </layoutGuides>
-                    <view key="view" contentMode="scaleToFill" id="XIc-19-qoq">
+                    <view key="view" contentMode="scaleToFill" id="XIc-19-qoq" customClass="LablancaView" customModule="app">
                         <rect key="frame" x="0.0" y="0.0" width="320" height="458"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <color key="backgroundColor" red="0.70980392156862748" green="0.82745098039215681" blue="0.89803921568627454" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                     </view>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="L8G-JV-V2l" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -270,15 +273,15 @@
                         <viewControllerLayoutGuide type="top" id="yir-Ne-huf"/>
                         <viewControllerLayoutGuide type="bottom" id="126-8G-plw"/>
                     </layoutGuides>
-                    <view key="view" contentMode="scaleToFill" id="c4t-ul-w0Z">
+                    <view key="view" contentMode="scaleToFill" id="c4t-ul-w0Z" customClass="BlogView" customModule="app" customModuleProvider="target">
                         <rect key="frame" x="0.0" y="0.0" width="320" height="458"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <color key="backgroundColor" red="1" green="0.33842284866451022" blue="0.42972784824945376" alpha="1" colorSpace="calibratedRGB"/>
+                        <color key="backgroundColor" red="0.70980392156862748" green="0.82745098039215681" blue="0.89803921568627454" alpha="1" colorSpace="calibratedRGB"/>
                     </view>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="iDB-bY-1MG" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="1643" y="1803"/>
+            <point key="canvasLocation" x="2081" y="2157"/>
         </scene>
         <!--Gallery-->
         <scene sceneID="Uqp-if-ZuD">
@@ -288,15 +291,406 @@
                         <viewControllerLayoutGuide type="top" id="yvh-VS-RXe"/>
                         <viewControllerLayoutGuide type="bottom" id="tOB-l0-rCU"/>
                     </layoutGuides>
-                    <view key="view" contentMode="scaleToFill" id="pPe-Xd-teA">
+                    <view key="view" contentMode="scaleToFill" id="pPe-Xd-teA" customClass="GalleryView" customModule="app" customModuleProvider="target">
                         <rect key="frame" x="0.0" y="0.0" width="320" height="458"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                        <color key="backgroundColor" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                     </view>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="2vc-bF-Qwf" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
             <point key="canvasLocation" x="1509" y="576"/>
         </scene>
+        <!--Post-->
+        <scene sceneID="zgg-Cx-j75">
+            <objects>
+                <viewController title="Post" id="UkS-wI-Yhx" customClass="PostViewController" customModule="app" customModuleProvider="target" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="yy6-d2-MRo"/>
+                        <viewControllerLayoutGuide type="bottom" id="IxZ-up-5UO"/>
+                    </layoutGuides>
+                    <view key="view" autoresizesSubviews="NO" contentMode="scaleToFill" id="mCJ-K1-jG1" userLabel="Container">
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="arX-Be-0iS" userLabel="Toolbar">
+                                <rect key="frame" x="0.0" y="20" width="320" height="30"/>
+                                <subviews>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="029-px-JqL">
+                                        <rect key="frame" x="0.0" y="0.0" width="48" height="30"/>
+                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+                                        <state key="normal" title="&lt;">
+                                            <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                        </state>
+                                    </button>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Gasteizko Margolariak" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BIE-D1-hCZ">
+                                        <rect key="frame" x="48" y="-0.5" width="224" height="30"/>
+                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
+                                        <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                </subviews>
+                                <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                <constraints>
+                                    <constraint firstItem="BIE-D1-hCZ" firstAttribute="height" secondItem="arX-Be-0iS" secondAttribute="height" id="6Ck-IY-1CK"/>
+                                    <constraint firstItem="029-px-JqL" firstAttribute="centerY" secondItem="arX-Be-0iS" secondAttribute="centerY" id="Es5-Zm-aQk"/>
+                                    <constraint firstItem="BIE-D1-hCZ" firstAttribute="centerY" secondItem="arX-Be-0iS" secondAttribute="centerY" id="PkD-5w-aPZ"/>
+                                    <constraint firstItem="029-px-JqL" firstAttribute="height" secondItem="arX-Be-0iS" secondAttribute="height" id="RTL-TJ-15M"/>
+                                    <constraint firstItem="BIE-D1-hCZ" firstAttribute="width" secondItem="arX-Be-0iS" secondAttribute="width" multiplier="0.7" id="UOQ-6G-qoP"/>
+                                    <constraint firstItem="029-px-JqL" firstAttribute="width" secondItem="arX-Be-0iS" secondAttribute="width" multiplier="0.15" id="VYu-Jc-ahB"/>
+                                    <constraint firstItem="029-px-JqL" firstAttribute="leading" secondItem="arX-Be-0iS" secondAttribute="leading" id="o0K-dB-meB"/>
+                                    <constraint firstItem="BIE-D1-hCZ" firstAttribute="centerX" secondItem="arX-Be-0iS" secondAttribute="centerX" id="zrK-6B-Gff"/>
+                                </constraints>
+                            </view>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jx5-wy-ab4">
+                                <rect key="frame" x="0.0" y="50" width="320" height="518"/>
+                                <subviews>
+                                    <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" bounces="NO" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="14b-YG-Iyb">
+                                        <rect key="frame" x="0.0" y="0.0" width="320" height="518"/>
+                                        <subviews>
+                                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yIU-b9-Dc5" userLabel="Section">
+                                                <rect key="frame" x="10" y="10" width="300" height="995"/>
+                                                <subviews>
+                                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="Title" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tRk-Ti-VOu" userLabel="Title">
+                                                        <rect key="frame" x="0.0" y="0.0" width="300" height="30"/>
+                                                        <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                        <constraints>
+                                                            <constraint firstAttribute="height" constant="30" id="pTS-D5-LUl"/>
+                                                        </constraints>
+                                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                                        <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                        <nil key="highlightedColor"/>
+                                                    </label>
+                                                    <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="bSp-Sd-3qA" userLabel="Content">
+                                                        <rect key="frame" x="0.0" y="30" width="300" height="965"/>
+                                                        <subviews>
+                                                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7t9-eQ-KC7" userLabel="Post">
+                                                                <rect key="frame" x="8" y="8" width="284" height="949"/>
+                                                                <subviews>
+                                                                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="u3M-mi-Tyn" userLabel="Image">
+                                                                        <rect key="frame" x="0.0" y="10" width="284" height="71"/>
+                                                                        <constraints>
+                                                                            <constraint firstAttribute="height" constant="71" id="fQp-wR-eLU"/>
+                                                                        </constraints>
+                                                                    </imageView>
+                                                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Text" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2i2-HF-HyI" userLabel="Text">
+                                                                        <rect key="frame" x="14" y="91" width="256" height="826"/>
+                                                                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                                        <nil key="textColor"/>
+                                                                        <nil key="highlightedColor"/>
+                                                                    </label>
+                                                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tAc-xa-mg2" userLabel="Separator">
+                                                                        <rect key="frame" x="14" y="917" width="256" height="2"/>
+                                                                        <color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                                                                        <constraints>
+                                                                            <constraint firstAttribute="height" constant="2" id="TTW-wU-fHT"/>
+                                                                        </constraints>
+                                                                    </view>
+                                                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="254" text="Date" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pX4-mq-dj0" userLabel="Date">
+                                                                        <rect key="frame" x="14" y="929" width="256" height="20"/>
+                                                                        <constraints>
+                                                                            <constraint firstAttribute="height" constant="20" id="Qos-eG-WmY"/>
+                                                                        </constraints>
+                                                                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                                        <nil key="textColor"/>
+                                                                        <nil key="highlightedColor"/>
+                                                                    </label>
+                                                                </subviews>
+                                                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                <constraints>
+                                                                    <constraint firstItem="u3M-mi-Tyn" firstAttribute="width" secondItem="7t9-eQ-KC7" secondAttribute="width" id="4ZF-fF-btB"/>
+                                                                    <constraint firstItem="tAc-xa-mg2" firstAttribute="centerX" secondItem="7t9-eQ-KC7" secondAttribute="centerX" id="Bf4-vV-UnB"/>
+                                                                    <constraint firstItem="pX4-mq-dj0" firstAttribute="width" secondItem="7t9-eQ-KC7" secondAttribute="width" multiplier="0.9" id="Dqr-hS-PV9"/>
+                                                                    <constraint firstItem="2i2-HF-HyI" firstAttribute="centerX" secondItem="7t9-eQ-KC7" secondAttribute="centerX" id="Hoe-4Q-YTi"/>
+                                                                    <constraint firstItem="pX4-mq-dj0" firstAttribute="centerX" secondItem="7t9-eQ-KC7" secondAttribute="centerX" id="U33-D3-0dG"/>
+                                                                    <constraint firstItem="2i2-HF-HyI" firstAttribute="width" secondItem="7t9-eQ-KC7" secondAttribute="width" multiplier="0.9" id="dcP-of-FdV"/>
+                                                                    <constraint firstItem="2i2-HF-HyI" firstAttribute="top" secondItem="u3M-mi-Tyn" secondAttribute="bottom" constant="10" id="enp-lt-dAC"/>
+                                                                    <constraint firstItem="u3M-mi-Tyn" firstAttribute="centerX" secondItem="7t9-eQ-KC7" secondAttribute="centerX" id="gd8-xG-NLo"/>
+                                                                    <constraint firstItem="tAc-xa-mg2" firstAttribute="width" secondItem="7t9-eQ-KC7" secondAttribute="width" multiplier="0.9" id="h9c-Tr-HaL"/>
+                                                                    <constraint firstItem="u3M-mi-Tyn" firstAttribute="top" secondItem="7t9-eQ-KC7" secondAttribute="top" constant="10" id="ilB-HA-43E"/>
+                                                                    <constraint firstAttribute="bottom" secondItem="pX4-mq-dj0" secondAttribute="bottom" id="j3Q-f8-ncG"/>
+                                                                    <constraint firstItem="tAc-xa-mg2" firstAttribute="top" secondItem="2i2-HF-HyI" secondAttribute="bottom" id="sQe-ZF-dDj"/>
+                                                                    <constraint firstItem="pX4-mq-dj0" firstAttribute="top" secondItem="tAc-xa-mg2" secondAttribute="bottom" constant="10" id="y6S-1C-uEC"/>
+                                                                </constraints>
+                                                                <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                                                <userDefinedRuntimeAttributes>
+                                                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                        <color key="value" red="0.42745098040000001" green="0.41176470590000003" blue="0.56470588239999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                        <real key="value" value="1"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                        <real key="value" value="3"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                </userDefinedRuntimeAttributes>
+                                                            </view>
+                                                        </subviews>
+                                                        <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                                        <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                                    </stackView>
+                                                </subviews>
+                                                <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                                <constraints>
+                                                    <constraint firstItem="bSp-Sd-3qA" firstAttribute="width" secondItem="yIU-b9-Dc5" secondAttribute="width" id="48B-MC-FiI"/>
+                                                    <constraint firstItem="tRk-Ti-VOu" firstAttribute="width" secondItem="yIU-b9-Dc5" secondAttribute="width" id="8hp-PL-zs2"/>
+                                                    <constraint firstAttribute="bottom" secondItem="bSp-Sd-3qA" secondAttribute="bottom" id="AmB-6T-H8u"/>
+                                                    <constraint firstItem="tRk-Ti-VOu" firstAttribute="centerX" secondItem="yIU-b9-Dc5" secondAttribute="centerX" id="GLO-lV-zKm"/>
+                                                    <constraint firstItem="tRk-Ti-VOu" firstAttribute="top" secondItem="yIU-b9-Dc5" secondAttribute="top" id="kvI-es-Bmu"/>
+                                                    <constraint firstItem="bSp-Sd-3qA" firstAttribute="centerX" secondItem="yIU-b9-Dc5" secondAttribute="centerX" id="obg-Sv-CD5"/>
+                                                    <constraint firstItem="bSp-Sd-3qA" firstAttribute="top" secondItem="tRk-Ti-VOu" secondAttribute="bottom" id="wkt-kn-ZPO"/>
+                                                </constraints>
+                                                <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                                <userDefinedRuntimeAttributes>
+                                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                        <color key="value" red="0.0" green="0.0" blue="0.066666666669999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                    <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                        <real key="value" value="1"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                    <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                        <real key="value" value="8"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                </userDefinedRuntimeAttributes>
+                                            </view>
+                                        </subviews>
+                                        <color key="backgroundColor" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                        <constraints>
+                                            <constraint firstItem="yIU-b9-Dc5" firstAttribute="top" secondItem="14b-YG-Iyb" secondAttribute="top" constant="10" id="56X-pA-LLg"/>
+                                            <constraint firstItem="yIU-b9-Dc5" firstAttribute="trailing" secondItem="14b-YG-Iyb" secondAttribute="trailing" constant="10" id="8Xl-m3-1Xk"/>
+                                            <constraint firstItem="yIU-b9-Dc5" firstAttribute="centerX" secondItem="14b-YG-Iyb" secondAttribute="centerX" id="8oz-7C-ZSn"/>
+                                            <constraint firstAttribute="bottom" secondItem="yIU-b9-Dc5" secondAttribute="bottom" constant="10" id="BC1-pI-UDI"/>
+                                            <constraint firstItem="yIU-b9-Dc5" firstAttribute="leading" secondItem="14b-YG-Iyb" secondAttribute="leading" constant="10" id="SDQ-gY-p6d"/>
+                                        </constraints>
+                                        <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                        <userDefinedRuntimeAttributes>
+                                            <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                <real key="value" value="0.0"/>
+                                            </userDefinedRuntimeAttribute>
+                                        </userDefinedRuntimeAttributes>
+                                    </scrollView>
+                                </subviews>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                <constraints>
+                                    <constraint firstItem="14b-YG-Iyb" firstAttribute="top" secondItem="jx5-wy-ab4" secondAttribute="top" id="H0N-Z2-1N1"/>
+                                    <constraint firstItem="14b-YG-Iyb" firstAttribute="width" secondItem="jx5-wy-ab4" secondAttribute="width" id="UPZ-Yz-bgJ"/>
+                                    <constraint firstAttribute="bottom" secondItem="14b-YG-Iyb" secondAttribute="bottom" id="ht1-9m-ecR"/>
+                                    <constraint firstItem="14b-YG-Iyb" firstAttribute="centerX" secondItem="jx5-wy-ab4" secondAttribute="centerX" id="tgi-xm-huK"/>
+                                </constraints>
+                                <userDefinedRuntimeAttributes>
+                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                        <color key="value" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                    </userDefinedRuntimeAttribute>
+                                </userDefinedRuntimeAttributes>
+                            </view>
+                        </subviews>
+                        <color key="backgroundColor" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <constraints>
+                            <constraint firstItem="jx5-wy-ab4" firstAttribute="centerX" secondItem="mCJ-K1-jG1" secondAttribute="centerX" id="5lE-sn-JIj"/>
+                            <constraint firstItem="arX-Be-0iS" firstAttribute="top" secondItem="yy6-d2-MRo" secondAttribute="bottom" id="SYd-o2-Nm3"/>
+                            <constraint firstItem="jx5-wy-ab4" firstAttribute="top" secondItem="arX-Be-0iS" secondAttribute="bottom" id="i80-pQ-ZU9"/>
+                            <constraint firstItem="arX-Be-0iS" firstAttribute="centerX" secondItem="mCJ-K1-jG1" secondAttribute="centerX" id="jAL-9l-RFi"/>
+                            <constraint firstItem="jx5-wy-ab4" firstAttribute="width" secondItem="mCJ-K1-jG1" secondAttribute="width" id="lZY-vh-Ap2"/>
+                            <constraint firstItem="arX-Be-0iS" firstAttribute="width" secondItem="mCJ-K1-jG1" secondAttribute="width" id="r1S-WW-h1K"/>
+                            <constraint firstAttribute="bottom" secondItem="jx5-wy-ab4" secondAttribute="bottom" id="xI7-lL-Xhw"/>
+                        </constraints>
+                        <userDefinedRuntimeAttributes>
+                            <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                <real key="value" value="0.0"/>
+                            </userDefinedRuntimeAttribute>
+                        </userDefinedRuntimeAttributes>
+                    </view>
+                    <connections>
+                        <outlet property="barButton" destination="029-px-JqL" id="48Y-ht-xLk"/>
+                        <outlet property="barTitle" destination="BIE-D1-hCZ" id="Fwf-72-Zfe"/>
+                        <outlet property="postImage" destination="u3M-mi-Tyn" id="usY-gh-LBn"/>
+                        <outlet property="postText" destination="2i2-HF-HyI" id="Mmz-c2-N6D"/>
+                        <outlet property="postTitle" destination="tRk-Ti-VOu" id="7kU-Dg-MLX"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="r4n-Sk-nt4" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="-728" y="1744"/>
+        </scene>
+        <!--Album-->
+        <scene sceneID="R7a-5x-3QL">
+            <objects>
+                <viewController title="Album" id="k0M-Sk-DZM" customClass="AlbumViewController" customModule="app" customModuleProvider="target" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="ONc-DJ-6Kh"/>
+                        <viewControllerLayoutGuide type="bottom" id="Jfy-ak-hpJ"/>
+                    </layoutGuides>
+                    <view key="view" autoresizesSubviews="NO" contentMode="scaleToFill" id="iBY-d9-Ye4" userLabel="Container">
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kLX-yW-lMr" userLabel="Toolbar">
+                                <rect key="frame" x="0.0" y="20" width="320" height="30"/>
+                                <subviews>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Thj-0t-rxK">
+                                        <rect key="frame" x="0.0" y="0.0" width="48" height="30"/>
+                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+                                        <state key="normal" title="&lt;">
+                                            <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                        </state>
+                                    </button>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Gasteizko Margolariak" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LLe-aQ-Sbj">
+                                        <rect key="frame" x="48" y="0.0" width="224" height="30"/>
+                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
+                                        <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                </subviews>
+                                <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                <constraints>
+                                    <constraint firstItem="LLe-aQ-Sbj" firstAttribute="width" secondItem="kLX-yW-lMr" secondAttribute="width" multiplier="0.7" id="3sD-ex-RH9"/>
+                                    <constraint firstItem="LLe-aQ-Sbj" firstAttribute="centerY" secondItem="kLX-yW-lMr" secondAttribute="centerY" id="7Jj-rc-BTU"/>
+                                    <constraint firstItem="Thj-0t-rxK" firstAttribute="leading" secondItem="kLX-yW-lMr" secondAttribute="leading" id="Jcs-G1-TKC"/>
+                                    <constraint firstItem="Thj-0t-rxK" firstAttribute="centerY" secondItem="kLX-yW-lMr" secondAttribute="centerY" id="VWD-2l-QIQ"/>
+                                    <constraint firstItem="Thj-0t-rxK" firstAttribute="height" secondItem="kLX-yW-lMr" secondAttribute="height" id="XCm-uK-ZdM"/>
+                                    <constraint firstItem="LLe-aQ-Sbj" firstAttribute="height" secondItem="kLX-yW-lMr" secondAttribute="height" id="m2u-z2-gQX"/>
+                                    <constraint firstItem="LLe-aQ-Sbj" firstAttribute="centerX" secondItem="kLX-yW-lMr" secondAttribute="centerX" id="uyE-xa-dZu"/>
+                                    <constraint firstItem="Thj-0t-rxK" firstAttribute="width" secondItem="kLX-yW-lMr" secondAttribute="width" multiplier="0.15" id="uzO-gY-Kxq"/>
+                                </constraints>
+                            </view>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WEW-3s-kOI">
+                                <rect key="frame" x="0.0" y="50" width="320" height="518"/>
+                                <subviews>
+                                    <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" bounces="NO" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Kmd-tW-XIB">
+                                        <rect key="frame" x="0.0" y="0.0" width="320" height="518"/>
+                                        <subviews>
+                                            <view contentMode="scaleToFill" ambiguous="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="sej-1q-hlq" userLabel="Section">
+                                                <rect key="frame" x="10" y="10" width="300" height="1046"/>
+                                                <subviews>
+                                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="Title" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YsV-il-CeR" userLabel="Title">
+                                                        <rect key="frame" x="0.0" y="0.0" width="300" height="30"/>
+                                                        <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                        <constraints>
+                                                            <constraint firstAttribute="height" constant="30" id="1pw-9x-fqs"/>
+                                                        </constraints>
+                                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                                        <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                        <nil key="highlightedColor"/>
+                                                    </label>
+                                                    <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="NlX-b5-vyb" userLabel="Content">
+                                                        <rect key="frame" x="0.0" y="30" width="300" height="1016"/>
+                                                        <subviews>
+                                                            <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="YEF-04-q7Y" userLabel="Album">
+                                                                <rect key="frame" x="8" y="8" width="284" height="1000"/>
+                                                                <subviews>
+                                                                    <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="WRD-IZ-JpU">
+                                                                        <rect key="frame" x="0.0" y="0.0" width="284" height="1000"/>
+                                                                    </stackView>
+                                                                </subviews>
+                                                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                <constraints>
+                                                                    <constraint firstItem="WRD-IZ-JpU" firstAttribute="centerY" secondItem="YEF-04-q7Y" secondAttribute="centerY" id="HMS-4q-ns8"/>
+                                                                    <constraint firstItem="WRD-IZ-JpU" firstAttribute="width" secondItem="YEF-04-q7Y" secondAttribute="width" id="Im5-F6-vGb"/>
+                                                                    <constraint firstItem="WRD-IZ-JpU" firstAttribute="height" secondItem="YEF-04-q7Y" secondAttribute="height" id="U7o-HF-khX"/>
+                                                                    <constraint firstItem="WRD-IZ-JpU" firstAttribute="centerX" secondItem="YEF-04-q7Y" secondAttribute="centerX" id="jKg-n6-Kko"/>
+                                                                </constraints>
+                                                                <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                                                <userDefinedRuntimeAttributes>
+                                                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                        <color key="value" red="0.42745098040000001" green="0.41176470590000003" blue="0.56470588239999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                        <real key="value" value="1"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                        <real key="value" value="3"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                </userDefinedRuntimeAttributes>
+                                                            </view>
+                                                        </subviews>
+                                                        <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                                        <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                                    </stackView>
+                                                </subviews>
+                                                <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                                <constraints>
+                                                    <constraint firstItem="NlX-b5-vyb" firstAttribute="centerX" secondItem="sej-1q-hlq" secondAttribute="centerX" id="11D-qS-lDY"/>
+                                                    <constraint firstItem="YsV-il-CeR" firstAttribute="centerX" secondItem="sej-1q-hlq" secondAttribute="centerX" id="Oym-KM-sqY"/>
+                                                    <constraint firstItem="NlX-b5-vyb" firstAttribute="top" secondItem="YsV-il-CeR" secondAttribute="bottom" id="kG4-rx-MOP"/>
+                                                    <constraint firstItem="NlX-b5-vyb" firstAttribute="width" secondItem="sej-1q-hlq" secondAttribute="width" id="mxX-S0-Jhg"/>
+                                                    <constraint firstItem="YsV-il-CeR" firstAttribute="width" secondItem="sej-1q-hlq" secondAttribute="width" id="ql7-1w-gZt"/>
+                                                    <constraint firstItem="YsV-il-CeR" firstAttribute="top" secondItem="sej-1q-hlq" secondAttribute="top" id="tWs-7c-cHP"/>
+                                                    <constraint firstAttribute="bottom" secondItem="NlX-b5-vyb" secondAttribute="bottom" id="tfG-n0-ydH"/>
+                                                </constraints>
+                                                <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                                <userDefinedRuntimeAttributes>
+                                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                        <color key="value" red="0.0" green="0.0" blue="0.066666666669999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                    <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                        <real key="value" value="1"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                    <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                        <real key="value" value="8"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                </userDefinedRuntimeAttributes>
+                                            </view>
+                                        </subviews>
+                                        <color key="backgroundColor" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                        <constraints>
+                                            <constraint firstItem="sej-1q-hlq" firstAttribute="trailing" secondItem="Kmd-tW-XIB" secondAttribute="trailing" constant="10" id="Axn-3D-Qni"/>
+                                            <constraint firstItem="sej-1q-hlq" firstAttribute="top" secondItem="Kmd-tW-XIB" secondAttribute="top" constant="10" id="W3n-lX-oj8"/>
+                                            <constraint firstItem="sej-1q-hlq" firstAttribute="leading" secondItem="Kmd-tW-XIB" secondAttribute="leading" constant="10" id="k9J-Pf-W1C"/>
+                                            <constraint firstItem="sej-1q-hlq" firstAttribute="centerX" secondItem="Kmd-tW-XIB" secondAttribute="centerX" id="sn2-ir-MIe"/>
+                                            <constraint firstAttribute="bottom" secondItem="sej-1q-hlq" secondAttribute="bottom" constant="10" id="uH3-zh-3sM"/>
+                                        </constraints>
+                                        <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                        <userDefinedRuntimeAttributes>
+                                            <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                <real key="value" value="0.0"/>
+                                            </userDefinedRuntimeAttribute>
+                                        </userDefinedRuntimeAttributes>
+                                    </scrollView>
+                                </subviews>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                <constraints>
+                                    <constraint firstAttribute="bottom" secondItem="Kmd-tW-XIB" secondAttribute="bottom" id="0Uz-ek-vBj"/>
+                                    <constraint firstItem="Kmd-tW-XIB" firstAttribute="width" secondItem="WEW-3s-kOI" secondAttribute="width" id="Bi9-mv-NSg"/>
+                                    <constraint firstItem="Kmd-tW-XIB" firstAttribute="top" secondItem="WEW-3s-kOI" secondAttribute="top" id="S3J-3p-RrM"/>
+                                    <constraint firstItem="Kmd-tW-XIB" firstAttribute="centerX" secondItem="WEW-3s-kOI" secondAttribute="centerX" id="aXw-Ot-IDF"/>
+                                </constraints>
+                                <userDefinedRuntimeAttributes>
+                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                        <color key="value" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                    </userDefinedRuntimeAttribute>
+                                </userDefinedRuntimeAttributes>
+                            </view>
+                        </subviews>
+                        <color key="backgroundColor" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <constraints>
+                            <constraint firstItem="kLX-yW-lMr" firstAttribute="top" secondItem="ONc-DJ-6Kh" secondAttribute="bottom" id="1cs-f7-eXV"/>
+                            <constraint firstItem="WEW-3s-kOI" firstAttribute="centerX" secondItem="iBY-d9-Ye4" secondAttribute="centerX" id="7rG-90-CBm"/>
+                            <constraint firstItem="WEW-3s-kOI" firstAttribute="width" secondItem="iBY-d9-Ye4" secondAttribute="width" id="L71-wc-a42"/>
+                            <constraint firstItem="WEW-3s-kOI" firstAttribute="top" secondItem="kLX-yW-lMr" secondAttribute="bottom" id="NlL-cF-RyX"/>
+                            <constraint firstItem="kLX-yW-lMr" firstAttribute="centerX" secondItem="iBY-d9-Ye4" secondAttribute="centerX" id="XK7-sC-KU0"/>
+                            <constraint firstAttribute="bottom" secondItem="WEW-3s-kOI" secondAttribute="bottom" id="h2X-Gs-sB2"/>
+                            <constraint firstItem="kLX-yW-lMr" firstAttribute="width" secondItem="iBY-d9-Ye4" secondAttribute="width" id="nmM-Cs-aC6"/>
+                        </constraints>
+                        <userDefinedRuntimeAttributes>
+                            <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                <real key="value" value="0.0"/>
+                            </userDefinedRuntimeAttribute>
+                        </userDefinedRuntimeAttributes>
+                    </view>
+                    <connections>
+                        <outlet property="albumContainer" destination="WRD-IZ-JpU" id="tSP-7c-APp"/>
+                        <outlet property="albumTitle" destination="YsV-il-CeR" id="t9S-NX-eaE"/>
+                        <outlet property="albumView" destination="YEF-04-q7Y" id="7tR-Lr-9nh"/>
+                        <outlet property="barButton" destination="Thj-0t-rxK" id="6bX-xo-abt"/>
+                        <outlet property="barTitle" destination="LLe-aQ-Sbj" id="bFR-jT-Xmq"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="GLj-OZ-Cqc" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="-1978" y="1477"/>
+        </scene>
     </scenes>
+    <resources>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
 </document>

+ 203 - 0
app/BlogView.swift

@@ -0,0 +1,203 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import CoreData
+import UIKit
+/**
+Class to handle the home view.
+*/
+class BlogView: UIView {
+	
+	//var window:UIWindow?
+	
+	//The main scroll view.
+	@IBOutlet weak var scrollView: UIScrollView!
+	
+	//The container of the view.
+	@IBOutlet var container: UIView!
+	
+	//Each of the sections of the view.
+	@IBOutlet weak var section: Section!
+	
+	//var controller : ViewController
+	
+	var delegate: AppDelegate? = nil
+	
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	/**
+	Run when the view is started.
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		
+		super.init(coder: aDecoder)
+		
+		print("BLOG:DEBUG: init.")
+		
+		//Load the contents of the HomeView.xib file.
+		Bundle.main.loadNibNamed("BlogView", owner: self, options: nil)
+		self.addSubview(container)
+		container.frame = self.bounds
+		section.setTitle(text: "Blog")
+		let parent = section.getContentStack()
+		
+		// Get viewController from StoryBoard
+		let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
+		let controller = storyboard.instantiateViewController(withIdentifier: "GMViewController") as! ViewController
+		
+		// Show posts
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		self.delegate = appDelegate
+		let lang : String = getLanguage()
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		let fetchRequest: NSFetchRequest<Post> = Post.fetchRequest()
+		let sortDescriptor = NSSortDescriptor(key: "dtime", ascending: false)
+		let sortDescriptors = [sortDescriptor]
+		fetchRequest.sortDescriptors = sortDescriptors
+		
+		do {
+			//go get the results
+			let searchResults = try context.fetch(fetchRequest)
+			
+			//I like to check the size of the returned results!
+			print ("BLOG:DEBUG: Total posts: \(searchResults.count)")
+			
+			var row : RowBlog
+			var count = 0
+			var id: Int
+			var title: String
+			var text: String
+			var image: String
+			
+			//You need to convert to NSManagedObject to use 'for' loops
+			for r in searchResults as [NSManagedObject] {
+				count = count + 1
+				//get the Key Value pairs (although there may be a better way to do that...
+				print("BLOG:DEBUG: Post perm: \(r.value(forKey: "permalink"))")
+				
+				
+				//Create a new row
+				row = RowBlog.init(s: "rowBlog\(count)", i: count)
+				id = r.value(forKey: "id")! as! Int
+				title = r.value(forKey: "title_\(lang)")! as! String
+				text = r.value(forKey: "text_\(lang)")! as! String
+				row.setTitle(text: title)
+				row.setText(text: text)
+				
+				// Get main image
+				image = ""
+				let imgFetchRequest: NSFetchRequest<Post_image> = Post_image.fetchRequest()
+				let imgSortDescriptor = NSSortDescriptor(key: "idx", ascending: true)
+				let imgSortDescriptors = [imgSortDescriptor]
+				imgFetchRequest.sortDescriptors = imgSortDescriptors
+				imgFetchRequest.predicate = NSPredicate(format: "post == %i", id)
+				imgFetchRequest.fetchLimit = 1
+				do{
+					let imgSearchResults = try context.fetch(imgFetchRequest)
+					for imgR in imgSearchResults as [NSManagedObject]{
+						image = imgR.value(forKey: "image")! as! String
+						print ("BLOG:DEBUG: Image: \(image)")
+						row.setImage(filename: image)
+					}
+				} catch {
+					print("BLOG:ERROR: Error getting image for post \(id): \(error)")
+				}
+				
+				print("BLOG:DEBUG: Row height: \(row.frame.height)")
+				
+				parent.addArrangedSubview(row)
+				row.setNeedsLayout()
+				row.layoutIfNeeded()
+				
+				// TODO: Do this on the row didLoad method
+				// Set tap recognizer
+				//let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(openPost(_:)))
+				//row.isUserInteractionEnabled = true
+				//row.addGestureRecognizer(tapRecognizer)
+				
+				
+				
+			}
+		} catch {
+			print("BLOG:ERROR: Error with request: \(error)")
+		}
+		
+		//Always at the end: update scrollview
+		var h: Int = 0
+		for view in scrollView.subviews {
+			//contentRect = contentRect.union(view.frame);
+			h = h + Int(view.frame.height) + 30 //Why 30?
+			print("BLOG:DEBUG: curh: \(h)")
+		}
+		// TODO: Calculate at the end
+		self.scrollView.contentSize.height = 2500//CGFloat(h);
+		
+		// The view controller
+		//var viewController: ViewController  = self.window?.rootViewController as! ViewController
+		
+		
+		//let viewController = UIApplication.topViewController() as! ViewController
+		
+		//viewController.showPost(id: 4)
+		
+		//print("BLOG:DEBUG: Show post on load.")
+		//self.delegate?.controller?.showPost(id: 4)
+		
+		//controller.showPost(id: 4)
+		
+		
+		
+		
+		print("BLOG:DEBUG: Finished loading BlogView")
+	}
+	
+	/*func openPost(){//(_ sender:UITapGestureRecognizer? = nil){
+		print("BLOG:DEBUG: getting delegate and showing post.")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showPost(id: 4)
+		print("BLOG:DEBUG: Post should be shown.")
+	}
+	
+	func openPost(_ sender:UITapGestureRecognizer? = nil){
+		print("BLOG:DEBUG: getting delegate and showing post.")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showPost(id: 4)
+		print("BLOG:DEBUG: Post should be shown.")
+	}*/
+	
+	func getLanguage() -> String{
+		let pre = NSLocale.preferredLanguages[0].subStr(start: 0, end: 1)
+		if(pre == "es" || pre == "en" || pre == "eu"){
+			return pre
+		}
+		else{
+			return "es"
+		}
+	}
+	
+	func setController(controller: ViewController){
+		
+		//self.controller = controller
+	}
+}

+ 61 - 0
app/BlogView.xib

@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina3_5" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="BlogView" customModule="app">
+            <connections>
+                <outlet property="container" destination="iN0-l3-epB" id="Nzq-0W-kDj"/>
+                <outlet property="scrollView" destination="V2d-fd-cjO" id="0Px-EW-La0"/>
+                <outlet property="section" destination="xlt-p5-m6w" id="ITl-k7-X4B"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" userLabel="Container">
+            <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="V2d-fd-cjO">
+                    <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
+                    <subviews>
+                        <stackView contentMode="scaleToFill" axis="vertical" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="Iqa-PQ-TOo">
+                            <rect key="frame" x="0.0" y="0.0" width="320" height="2200"/>
+                            <subviews>
+                                <view autoresizesSubviews="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xlt-p5-m6w" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="0.0" width="320" height="2200"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="2200" id="dig-UC-mt1" userLabel="height = 2200"/>
+                                    </constraints>
+                                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                </view>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="xlt-p5-m6w" firstAttribute="top" secondItem="Iqa-PQ-TOo" secondAttribute="top" id="ARG-5x-hIU"/>
+                                <constraint firstAttribute="bottom" secondItem="xlt-p5-m6w" secondAttribute="bottom" id="EIU-Wo-4hn"/>
+                                <constraint firstAttribute="height" constant="2200" id="FSh-mk-71J"/>
+                            </constraints>
+                        </stackView>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="Iqa-PQ-TOo" firstAttribute="top" secondItem="V2d-fd-cjO" secondAttribute="top" id="JUm-Fl-IMw"/>
+                        <constraint firstAttribute="trailing" secondItem="Iqa-PQ-TOo" secondAttribute="trailing" id="NAr-lB-8Ty"/>
+                        <constraint firstItem="Iqa-PQ-TOo" firstAttribute="leading" secondItem="V2d-fd-cjO" secondAttribute="leading" id="wWa-rA-U3w"/>
+                        <constraint firstAttribute="bottom" secondItem="Iqa-PQ-TOo" secondAttribute="bottom" id="x0w-9j-39f"/>
+                    </constraints>
+                </scrollView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="V2d-fd-cjO" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="JsC-UU-8eB"/>
+                <constraint firstItem="V2d-fd-cjO" firstAttribute="height" secondItem="iN0-l3-epB" secondAttribute="height" id="bBb-zb-kBf"/>
+                <constraint firstItem="V2d-fd-cjO" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="ddT-DW-Knz"/>
+                <constraint firstItem="V2d-fd-cjO" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="kdV-ei-kvf"/>
+            </constraints>
+        </view>
+    </objects>
+</document>

+ 187 - 0
app/GalleryView.swift

@@ -0,0 +1,187 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import CoreData
+import UIKit
+/**
+Class to handle the home view.
+*/
+class GalleryView: UIView {
+	
+	// Outlets
+	@IBOutlet var container: UIView!
+	@IBOutlet weak var scrollView: UIScrollView!
+	@IBOutlet weak var section: Section!
+	
+	// App delegate
+	var delegate: AppDelegate? = nil
+	
+	// Section row list
+	var rows: Array<RowGallery> = []
+	
+	/**
+	Run when the view is started.
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	/**
+	Run when the view is started.
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		
+		super.init(coder: aDecoder)
+		
+		NSLog(":GALLERY:LOG: Init gallery section.")
+		
+		//Load the contents of the HomeView.xib file.
+		Bundle.main.loadNibNamed("GalleryView", owner: self, options: nil)
+		self.addSubview(container)
+		container.frame = self.bounds
+		section.setTitle(text: "Gallery")
+		let parent = section.getContentStack()
+		
+		// Get viewController from StoryBoard
+		let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
+		let controller = storyboard.instantiateViewController(withIdentifier: "GMViewController") as! ViewController
+		
+		// Show albums
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		self.delegate = appDelegate
+		let lang : String = getLanguage()
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		let fetchRequest: NSFetchRequest<Album> = Album.fetchRequest()
+		let sortDescriptor = NSSortDescriptor(key: "time", ascending: false)
+		let sortDescriptors = [sortDescriptor]
+		fetchRequest.sortDescriptors = sortDescriptors
+		
+		do {
+			//Get the results
+			let searchResults = try context.fetch(fetchRequest)
+
+			var row : RowGallery
+			var count = 0
+			var id: Int
+			var title: String
+			for r in searchResults as [NSManagedObject] {
+				count = count + 1
+				
+				//Create a new row
+				row = RowGallery.init(s: "rowGallery\(count)", i: count)
+				id = r.value(forKey: "id")! as! Int
+				
+				title = r.value(forKey: "title_\(lang)")! as! String
+				row.id = id
+				row.setTitle(text: title)
+				
+				// Get 4 random images from the album
+				let imgFetchRequest: NSFetchRequest<Photo_album> = Photo_album.fetchRequest()
+				// TODO Order random
+				//let imgSortDescriptor = NSSortDescriptor(key: "time", ascending: true)
+				//let imgSortDescriptors = [imgSortDescriptor]
+				//simgFetchRequest.sortDescriptors = imgSortDescriptors
+				imgFetchRequest.predicate = NSPredicate(format: "album == %i", id)
+				imgFetchRequest.fetchLimit = 4
+				do{
+					let imgSearchResults = try context.fetch(imgFetchRequest)
+					
+					// Loop images
+					var imageIdx = 0
+					for imgR in imgSearchResults as [NSManagedObject]{
+						
+						let imageId = imgR.value(forKey: "photo")! as! Int
+						
+						// For each image, I need a new query to fetch from photo entity.
+						let singleImgFetchRequest: NSFetchRequest<Photo> = Photo.fetchRequest()
+						singleImgFetchRequest.predicate = NSPredicate(format: "id == %i", imageId)
+						singleImgFetchRequest.fetchLimit = 4
+						do{
+							let singleImgSearchResults = try context.fetch(singleImgFetchRequest)
+							
+							// Loop image
+							for sImgR in singleImgSearchResults as [NSManagedObject]{
+						
+								let image = sImgR.value(forKey: "file")! as! String
+								row.setImage(idx: imageIdx, filename: image)
+							}
+							imageIdx = imageIdx + 1
+						}
+						catch {
+							NSLog(":GALLERY:ERROR: Error getting image from photo entity: \(error)")
+						}
+					}
+				} catch {
+					NSLog(":GALLERY:ERROR: Error getting image for album \(id): \(error)")
+				}
+				
+				parent.addArrangedSubview(row)
+				
+				// Add to the rows array
+				self.rows.append(row)
+				
+				
+				
+			}
+		} catch {
+			NSLog(":GALLERY:ERROR: Error with request: \(error)")
+		}
+		
+		//Always at the end: update scrollview
+		var h: Int = 0
+		for view in scrollView.subviews {
+			//contentRect = contentRect.union(view.frame);
+			h = h + Int(view.frame.height) + 30 //Why 30?
+		}
+		// TODO: Calculate at the end
+		self.scrollView.contentSize.height = 2500//CGFloat(h);
+		
+		self.setUpRowsTapRecognizers()
+		NSLog(":GALLERY:LOG: Finished loading gallery section.")
+	}
+	
+	func openAlbum(_ sender:UITapGestureRecognizer? = nil){
+		let id = (sender?.view as! RowGallery).id
+		NSLog(":GALLERY:DEBUG: getting delegate and showing album \(id).")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showAlbum(id: id)
+	}
+	
+	func getLanguage() -> String{
+		let pre = NSLocale.preferredLanguages[0].subStr(start: 0, end: 1)
+		if(pre == "es" || pre == "en" || pre == "eu"){
+			return pre
+		}
+		else{
+			return "es"
+		}
+	}
+	
+	func setUpRowsTapRecognizers(){
+		NSLog(":GALLERY:DEBUG: Setting up tap recognizers")
+		for row in self.rows{
+			let tapRecognizer = UITapGestureRecognizer(target: row, action: #selector(openAlbum(_:)))
+			row.isUserInteractionEnabled = true
+			container.addGestureRecognizer(tapRecognizer)
+		}
+	}
+}

+ 62 - 0
app/GalleryView.xib

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="GalleryView" customModule="app" customModuleProvider="target">
+            <connections>
+                <outlet property="container" destination="iN0-l3-epB" id="75N-Q5-bZw"/>
+                <outlet property="scrollView" destination="aoy-Mh-gpR" id="6fj-Cm-cse"/>
+                <outlet property="section" destination="3TY-0K-6q1" id="bqj-sb-ZO2"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aoy-Mh-gpR">
+                    <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                    <subviews>
+                        <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="ULw-PH-L95">
+                            <rect key="frame" x="0.0" y="0.0" width="320" height="3000"/>
+                            <subviews>
+                                <view autoresizesSubviews="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3TY-0K-6q1" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="0.0" width="320" height="3000"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="3000" id="vPf-aG-EZ9"/>
+                                    </constraints>
+                                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                </view>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="3TY-0K-6q1" firstAttribute="top" secondItem="ULw-PH-L95" secondAttribute="top" id="0GM-gA-76X"/>
+                                <constraint firstItem="3TY-0K-6q1" firstAttribute="width" secondItem="ULw-PH-L95" secondAttribute="width" id="fZS-cn-vrg"/>
+                                <constraint firstAttribute="bottom" secondItem="3TY-0K-6q1" secondAttribute="bottom" id="n9J-oi-jRF"/>
+                            </constraints>
+                        </stackView>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="trailing" secondItem="ULw-PH-L95" secondAttribute="trailing" id="FEV-qn-MAO"/>
+                        <constraint firstItem="ULw-PH-L95" firstAttribute="leading" secondItem="aoy-Mh-gpR" secondAttribute="leading" id="LOc-iu-RwK"/>
+                        <constraint firstItem="ULw-PH-L95" firstAttribute="top" secondItem="aoy-Mh-gpR" secondAttribute="top" id="tCz-sX-2pl"/>
+                        <constraint firstAttribute="bottom" secondItem="ULw-PH-L95" secondAttribute="bottom" id="wJq-aC-CNc"/>
+                    </constraints>
+                </scrollView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="aoy-Mh-gpR" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="1sn-WI-SeL"/>
+                <constraint firstItem="aoy-Mh-gpR" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="53f-dW-QfI"/>
+                <constraint firstItem="aoy-Mh-gpR" firstAttribute="height" secondItem="iN0-l3-epB" secondAttribute="height" id="JAc-a5-eSB"/>
+                <constraint firstItem="aoy-Mh-gpR" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="KbH-35-FjR"/>
+                <constraint firstItem="aoy-Mh-gpR" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="ftc-db-cKU"/>
+            </constraints>
+        </view>
+    </objects>
+</document>

+ 212 - 5
app/HomeView.swift

@@ -70,15 +70,22 @@ class HomeView: UIView {
 		
 		//Get info to populate sections
 		let moc = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		
 		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		moc.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
 		let lang : String = getLanguage()
 		
 		//Populate sections
 		setUpPastActivities(context: moc, delegate: appDelegate, lang: lang, parent: pastActivitiesSection.getContentStack())
+		setUpBlog(context: moc, delegate: appDelegate, lang: lang, parent: blogSection.getContentStack())
+		setUpFutureActivities(context: moc, delegate: appDelegate, lang: lang, parent: futureActivitiesSection.getContentStack())
+		setUpSocial(parent: socialSection.getContentStack())
+		setUpGallery(context: moc, delegate: appDelegate, parent: gallerySection.getContentStack())
 		
 		
 		pastActivitiesSection.expandSection()
 		
+		
 		//Always at the end: update scrollview
 		var h: Int = 0
 		for view in scrollView.subviews {
@@ -87,7 +94,7 @@ class HomeView: UIView {
 			print("curh: \(h)")
 		}
 		// TODO: Calculate at the end
-		self.scrollView.contentSize.height = 1200// CGFloat(h);
+		self.scrollView.contentSize.height = 1300// CGFloat(h);
 	}
 	
 	func getLanguage() -> String{
@@ -100,15 +107,156 @@ class HomeView: UIView {
 		}
 	}
 	
+	func setUpFutureActivities(context : NSManagedObjectContext, delegate: AppDelegate, lang: String, parent : UIStackView){
+		
+		//context.persistentStoreCoordinator = delegate.persistentStoreCoordinator
+		let fetchRequest: NSFetchRequest<Activity> = Activity.fetchRequest()
+		let sortDescriptor = NSSortDescriptor(key: "date", ascending: true)
+		let sortDescriptors = [sortDescriptor]
+		fetchRequest.sortDescriptors = sortDescriptors
+		fetchRequest.predicate = NSPredicate(format: "date > %@", NSDate())
+		fetchRequest.fetchLimit = 2
+		
+		do {
+			//go get the results
+			let searchResults = try context.fetch(fetchRequest)
+			
+			//I like to check the size of the returned results!
+			print ("Activities: \(searchResults.count)")
+			
+			var row : RowHomePastActivities
+			var count = 0
+			var id: Int
+			var title: String
+			var text: String
+			var image: String
+			
+			//You need to convert to NSManagedObject to use 'for' loops
+			for r in searchResults as [NSManagedObject] {
+				count = count + 1
+				//get the Key Value pairs (although there may be a better way to do that...
+				print("Perm: \(r.value(forKey: "permalink"))")
+				
+				
+				//Create a new row
+				row = RowHomePastActivities.init(s: "rowHomeFutureActivities\(count)", i: count)
+				id = r.value(forKey: "id")! as! Int
+				title = r.value(forKey: "title_\(lang)")! as! String
+				text = r.value(forKey: "text_\(lang)")! as! String
+				print(title)
+				row.setTitle(text: title)
+				row.setText(text: text)
+				
+				// Get main image
+				image = ""
+				let imgFetchRequest: NSFetchRequest<Activity_image> = Activity_image.fetchRequest()
+				let imgSortDescriptor = NSSortDescriptor(key: "idx", ascending: true)
+				let imgSortDescriptors = [imgSortDescriptor]
+				imgFetchRequest.sortDescriptors = imgSortDescriptors
+				imgFetchRequest.predicate = NSPredicate(format: "activity == %i", id)
+				imgFetchRequest.fetchLimit = 1
+				do{
+					let imgSearchResults = try context.fetch(imgFetchRequest)
+					for imgR in imgSearchResults as [NSManagedObject]{
+						image = imgR.value(forKey: "image")! as! String
+						print ("IMAGE: \(image)")
+						row.setImage(filename: image)
+					}
+				} catch {
+					print("Error getting image for activity \(id): \(error)")
+				}
+				
+				print("Row height: \(row.frame.height)")
+				
+				parent.addArrangedSubview(row)
+				
+			}
+		} catch {
+			print("Error with request: \(error)")
+		}
+	}
+	
+	func setUpBlog(context : NSManagedObjectContext, delegate: AppDelegate, lang: String, parent : UIStackView){
+		
+		//context.persistentStoreCoordinator = delegate.persistentStoreCoordinator
+		let fetchRequest: NSFetchRequest<Post> = Post.fetchRequest()
+		let sortDescriptor = NSSortDescriptor(key: "dtime", ascending: false)
+		let sortDescriptors = [sortDescriptor]
+		fetchRequest.sortDescriptors = sortDescriptors
+		fetchRequest.fetchLimit = 2
+		
+		do {
+			//go get the results
+			let searchResults = try context.fetch(fetchRequest)
+			
+			//I like to check the size of the returned results!
+			print ("Post: \(searchResults.count)")
+			
+			var row : RowHomeBlog
+			var count = 0
+			var id: Int
+			var title: String
+			var text: String
+			var image: String
+			
+			//You need to convert to NSManagedObject to use 'for' loops
+			for r in searchResults as [NSManagedObject] {
+				count = count + 1
+				//get the Key Value pairs (although there may be a better way to do that...
+				print("Perm: \(r.value(forKey: "permalink"))")
+				
+				
+				//Create a new row
+				row = RowHomeBlog.init(s: "rowHomeBlog\(count)", i: count)
+				id = r.value(forKey: "id")! as! Int
+				title = r.value(forKey: "title_\(lang)")! as! String
+				text = r.value(forKey: "text_\(lang)")! as! String
+				
+				row.id = id
+				row.setTitle(text: title)
+				row.setText(text: text)
+				
+				// Get main image
+				image = ""
+				let imgFetchRequest: NSFetchRequest<Post_image> = Post_image.fetchRequest()
+				let imgSortDescriptor = NSSortDescriptor(key: "idx", ascending: true)
+				let imgSortDescriptors = [imgSortDescriptor]
+				imgFetchRequest.sortDescriptors = imgSortDescriptors
+				imgFetchRequest.predicate = NSPredicate(format: "post == %i", id)
+				imgFetchRequest.fetchLimit = 1
+				do{
+					let imgSearchResults = try context.fetch(imgFetchRequest)
+					for imgR in imgSearchResults as [NSManagedObject]{
+						image = imgR.value(forKey: "image")! as! String
+						print ("IMAGE: \(image)")
+						row.setImage(filename: image)
+					}
+				} catch {
+					print("Error getting image for post \(id): \(error)")
+				}
+				
+				print("Row height: \(row.frame.height)")
+				
+				parent.addArrangedSubview(row)
+				
+				let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(openPost(_:)))
+				row.isUserInteractionEnabled = true
+				row.addGestureRecognizer(tapRecognizer)
+				
+			}
+		} catch {
+			print("Error with request: \(error)")
+		}
+	}
+	
 	func setUpPastActivities(context : NSManagedObjectContext, delegate: AppDelegate, lang: String, parent : UIStackView){
 		
-		context.persistentStoreCoordinator = delegate.persistentStoreCoordinator
+		//context.persistentStoreCoordinator = delegate.persistentStoreCoordinator
 		let fetchRequest: NSFetchRequest<Activity> = Activity.fetchRequest()
 		let sortDescriptor = NSSortDescriptor(key: "date", ascending: false)
 		let sortDescriptors = [sortDescriptor]
 		fetchRequest.sortDescriptors = sortDescriptors
-		//TODO Compare dates
-		//fetchRequest.predicate = NSPredicate(format: "date < %@", sysdate)
+		fetchRequest.predicate = NSPredicate(format: "date <= %@", NSDate())
 		fetchRequest.fetchLimit = 2
 		
 		do {
@@ -137,7 +285,8 @@ class HomeView: UIView {
 				id = r.value(forKey: "id")! as! Int
 				title = r.value(forKey: "title_\(lang)")! as! String
 				text = r.value(forKey: "text_\(lang)")! as! String
-				print(title)
+				
+				
 				row.setTitle(text: title)
 				row.setText(text: text)
 				
@@ -169,4 +318,62 @@ class HomeView: UIView {
 			print("Error with request: \(error)")
 		}
 	}
+	
+	func setUpGallery(context : NSManagedObjectContext, delegate: AppDelegate,parent: UIStackView){
+		print("HOME:LOG: Setting up gallery.")
+		
+		// Create the row
+		var row: RowHomeGallery
+		row = RowHomeGallery.init(s: "rowHomeGallery", i: 0)
+		parent.addArrangedSubview(row)
+		
+		
+		// Set images
+		let fetchRequest: NSFetchRequest<Photo> = Photo.fetchRequest()
+		let sortDescriptor = NSSortDescriptor(key: "uploaded", ascending: false)
+		let sortDescriptors = [sortDescriptor]
+		fetchRequest.sortDescriptors = sortDescriptors
+		fetchRequest.fetchLimit = 4
+		
+		do {
+			//go get the results
+			let searchResults = try context.fetch(fetchRequest)
+	
+			var id: Int
+			var image: String
+			
+			// Loop images
+			var i = 0
+			for r in searchResults as [NSManagedObject] {
+				
+				image = r.value(forKey: "file")! as! String
+				row.setImage(idx: i, filename: image)
+				
+				//TODO Set click listener
+				
+				i = i + 1
+			}
+			
+		}
+		catch{
+			print("HOME:ERROR: Error setting gallery up: \(error)")
+		}
+		
+	}
+	
+	func setUpSocial(parent : UIStackView){
+		print("SETING UP SOCIAL")
+		//Create a new row
+		var row : RowHomeSocial
+		row = RowHomeSocial.init(s: "rowHomeSocial", i: 0)
+		print("ROW CREATED")
+		parent.addArrangedSubview(row)
+	}
+	
+	func openPost(_ sender:UITapGestureRecognizer? = nil){
+		print("HOME:DEBUG: getting delegate and showing post.")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showPost(id: (sender?.view as! RowHomeBlog).id)
+		print("HOME:DEBUG: Post should be shown.")
+	}
 }

+ 18 - 18
app/HomeView.xib

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16B2657" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina3_5" orientation="portrait">
         <adaptation id="fullscreen"/>
     </device>
@@ -27,37 +27,37 @@
             <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
-                <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Poy-ba-9jX">
+                <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Poy-ba-9jX">
                     <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
                     <subviews>
-                        <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="gOz-rr-CeQ">
-                            <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
+                        <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" axis="vertical" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="gOz-rr-CeQ">
+                            <rect key="frame" x="0.0" y="0.0" width="320" height="780"/>
                             <subviews>
-                                <view autoresizesSubviews="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ljm-NP-c4e" customClass="Section" customModule="app">
-                                    <rect key="frame" x="0.0" y="0.0" width="320" height="0.0"/>
+                                <view autoresizesSubviews="NO" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ljm-NP-c4e" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="0.0" width="320" height="50"/>
                                 </view>
-                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9nu-j1-wGI" customClass="Section" customModule="app">
-                                    <rect key="frame" x="0.0" y="0.0" width="320" height="0.0"/>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9nu-j1-wGI" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="60" width="320" height="50"/>
                                 </view>
-                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FQo-nm-4Mo" customClass="Section" customModule="app">
-                                    <rect key="frame" x="0.0" y="0.0" width="320" height="0.0"/>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FQo-nm-4Mo" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="120" width="320" height="50"/>
                                 </view>
-                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uHa-Mu-U68" customClass="Section" customModule="app">
-                                    <rect key="frame" x="0.0" y="0.0" width="320" height="0.0"/>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uHa-Mu-U68" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="180" width="320" height="50"/>
                                 </view>
-                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="v6A-Ya-esA" customClass="Section" customModule="app" customModuleProvider="target">
-                                    <rect key="frame" x="0.0" y="0.0" width="320" height="10"/>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="v6A-Ya-esA" customClass="Section" customModule="app" customModuleProvider="target">
+                                    <rect key="frame" x="0.0" y="240" width="320" height="50"/>
                                 </view>
-                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fZk-r1-Tca" customClass="Section" customModule="app">
-                                    <rect key="frame" x="0.0" y="10" width="320" height="350"/>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fZk-r1-Tca" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="300" width="320" height="350"/>
                                     <userDefinedRuntimeAttributes>
                                         <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
                                             <real key="value" value="0.0"/>
                                         </userDefinedRuntimeAttribute>
                                     </userDefinedRuntimeAttributes>
                                 </view>
-                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dgk-s8-xje" customClass="Section" customModule="app">
-                                    <rect key="frame" x="0.0" y="360" width="320" height="120"/>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dgk-s8-xje" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="660" width="320" height="120"/>
                                 </view>
                             </subviews>
                             <color key="backgroundColor" red="1" green="1" blue="0.42787000868055558" alpha="1" colorSpace="calibratedRGB"/>

+ 194 - 0
app/LablancaView.swift

@@ -0,0 +1,194 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import CoreData
+import UIKit
+/**
+Class to handle the home view.
+*/
+class LablancaView: UIView {
+
+	@IBOutlet var container: UIView!			// Top container of the view.
+	@IBOutlet weak var nfWindow: UIView!		// The section to show when no festivals.
+	@IBOutlet weak var fWindow: UIView!			// The window to show while the festivals.
+	@IBOutlet weak var fTitle: UILabel!			// The title of the year festivals.
+	@IBOutlet weak var fImage: UIImageView!		// The festivals image
+	@IBOutlet weak var fText: UILabel!			// The festivals description.
+	@IBOutlet weak var fBtSchedule: UIButton!	// Button to show the city schedule.
+	@IBOutlet weak var fBtGMSchedule: UIButton!	// Button to show the Margolari schedule
+	@IBOutlet weak var fOfferList: UIStackView!	// Stack view to hold the offer list.
+	@IBOutlet weak var fDayList: UIStackView!	// Stack view to hold the single days price list.
+	
+	
+	
+	// App delegate
+	var delegate: AppDelegate? = nil
+	
+	// Section row list
+	//var rows: Array<RowGallery> = []
+	
+	/**
+	Run when the view is started.
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	/**
+	Run when the view is started.
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		
+		super.init(coder: aDecoder)
+		
+		NSLog(":LABLANCA:LOG: Init lablanca section.")
+
+		Bundle.main.loadNibNamed("LablancaView", owner: self, options: nil)
+		self.addSubview(container)
+		container.frame = self.bounds
+		
+		// Get viewController from StoryBoard
+		let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
+		let controller = storyboard.instantiateViewController(withIdentifier: "GMViewController") as! ViewController
+		
+		// Read settings and show the required sections
+		let defaults = UserDefaults.standard
+		let festivals: Int = 1 //TODO defaults.integer(forKey: "festivals")
+		
+		if festivals == 1{
+			showFestivals()
+		}
+		else{
+			showNoFestivals()
+		}
+	}
+	
+	func showFestivals(){
+		NSLog(":LABLANCA:LOG: Showing festivals section.")
+		self.nfWindow.isHidden = true
+		
+		// TODO: Get current year
+		let year = 2016
+		
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let lang : String = getLanguage()
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		
+		// Get info about festivals
+		let fetchRequest: NSFetchRequest<Festival> = Festival.fetchRequest()
+		fetchRequest.predicate = NSPredicate(format: "year = %i", year)
+		
+		do {
+			
+			// Get info from festivals
+			let searchResults = try context.fetch(fetchRequest)
+			let r = searchResults[0]
+			
+			// Set description
+			self.fText.text = r.value(forKey: "text_\(lang)") as! String?
+
+		} catch {
+			NSLog(":LABLANCA:ERROR: Error getting festivals info: \(error)")
+		}
+		
+		// Get info about the day prices.
+		let dateFormatter = DateFormatter()
+		dateFormatter.dateFormat = "yyyy-MM-dd"
+		dateFormatter.locale = Locale.init(identifier: "en_GB")
+		
+		// First date of year
+		var dateString = "\(year)-01-01"
+		let sDate = dateFormatter.date(from: dateString)
+		
+		// Last date of year
+		dateString = "\(year)-12-31"
+		let eDate = dateFormatter.date(from: dateString)
+		
+		// Get days
+		let dayFetchRequest: NSFetchRequest<Festival_day> = Festival_day.fetchRequest()
+		dayFetchRequest.predicate = NSPredicate(format: "(date >= %@) AND (date <= %@)", argumentArray: [sDate, eDate])
+		
+		do {
+			
+			// Get info from festivals
+			let daySearchResults = try context.fetch(dayFetchRequest)
+			
+			var row: RowLablancaDay
+			var count: Int = 0
+			
+			for day in daySearchResults as [NSManagedObject]{
+				
+				let date: NSDate = day.value(forKey: "date")! as! NSDate
+				let dateString: String = dateFormatter.string(from: date as Date)
+				let nDay: String = dateString.subStr(start: 8, end: 9)
+				let month: String = dateString.subStr(start: 5, end: 6)
+				var nMonth: String = "Agosto" // TODO: Reference
+				if month == "07"{
+					nMonth = "Julio" // TODO: Reference
+				}
+				let name: String = day.value(forKey: "name_\(lang)")! as! String
+				let price: Int = day.value(forKey: "price")! as! Int
+				
+				// Create the row and set data.
+				row = RowLablancaDay.init(s: "rowLablancaDay\(count)", i: count)
+				row.name.text = name
+				row.price.text = "\(price) €"
+				row.number.text = "\(Int(nDay)!)"
+				row.month.text = nMonth
+				
+				// Add the row
+				fDayList.addArrangedSubview(row)
+				row.setNeedsLayout()
+				row.layoutIfNeeded()
+				
+				// Hide the separator of the last row
+				if count == daySearchResults.count - 1 {
+					row.separator.isHidden = true
+				}
+				
+				count = count + 1
+			}
+			
+		} catch {
+			NSLog(":LABLANCA:ERROR: Error getting festival days info: \(error)")
+		}
+		
+		
+		
+	}
+	
+	func showNoFestivals(){
+		NSLog(":LABLANCA:LOG: Showing no festivals section.")
+		self.fWindow.isHidden = true
+		// Nothing else to be done.
+	}
+	
+	func getLanguage() -> String{
+		let pre = NSLocale.preferredLanguages[0].subStr(start: 0, end: 1)
+		if(pre == "es" || pre == "en" || pre == "eu"){
+			return pre
+		}
+		else{
+			return "es"
+		}
+	}
+}

+ 407 - 0
app/LablancaView.xib

@@ -0,0 +1,407 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="LablancaView" customModule="app">
+            <connections>
+                <outlet property="container" destination="iN0-l3-epB" id="ST9-WZ-eac"/>
+                <outlet property="fBtGMSchedule" destination="sX5-OY-Jg0" id="mdf-kv-Msn"/>
+                <outlet property="fBtSchedule" destination="LqL-cc-rQ7" id="Vtj-4O-mS4"/>
+                <outlet property="fDayList" destination="qKn-wk-VDT" id="Eb2-oe-9fR"/>
+                <outlet property="fImage" destination="61f-V8-Jtw" id="UNp-gk-xTb"/>
+                <outlet property="fOfferList" destination="rcX-IS-Hmj" id="Y1a-Rq-6n2"/>
+                <outlet property="fText" destination="tlF-oW-fKA" id="LNb-2w-WMR"/>
+                <outlet property="fTitle" destination="Uf0-CR-dfk" id="uQa-yj-CK7"/>
+                <outlet property="fWindow" destination="O30-vI-Tga" id="I1G-s6-BsO"/>
+                <outlet property="nfWindow" destination="ANk-4K-DBn" id="Orc-2Z-DU4"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tXE-yu-DoB">
+                    <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                    <subviews>
+                        <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="onh-i9-8Tz">
+                            <rect key="frame" x="0.0" y="0.0" width="375" height="1255.5"/>
+                            <subviews>
+                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1tl-Rf-vmM">
+                                    <rect key="frame" x="0.0" y="0.0" width="375" height="1255.5"/>
+                                    <subviews>
+                                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ANk-4K-DBn" userLabel="NoFestivals">
+                                            <rect key="frame" x="10" y="10" width="355" height="1235.5"/>
+                                            <subviews>
+                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="NFTitle" text="NoFestivals" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rbu-EN-1UC" userLabel="NFTitle">
+                                                    <rect key="frame" x="0.0" y="0.0" width="355" height="30"/>
+                                                    <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="30" id="Go6-nx-Txf"/>
+                                                    </constraints>
+                                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                                    <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                    <nil key="highlightedColor"/>
+                                                </label>
+                                                <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="61P-J5-lJc">
+                                                    <rect key="frame" x="0.0" y="30" width="355" height="1205.5"/>
+                                                    <subviews>
+                                                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fMm-Rh-0GJ">
+                                                            <rect key="frame" x="0.0" y="0.0" width="355" height="1205.5"/>
+                                                            <subviews>
+                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JSe-pA-fF3" userLabel="NFText">
+                                                                    <rect key="frame" x="8" y="8" width="339" height="1189.5"/>
+                                                                    <string key="text">Las Fiestas de La Blanca. Esos días, del 4 al 9 de agosto, en los que Vitoria-Gasteiz se transforma. Se llena de color y alegría, y en cada esquina puedes encontrar actividades y espectáculos.
+
+Nosotros, como cuadrilla de Blusas y Nescas, ya estamos trabajando en ello. Tan pronto como vayamos sabiendo más, aquí iremos publicando nuestro programa y otra información sobre las fiestas.
+
+Para ir abriendo boca, dejanos contarte algunas de las claves del plan Margolari de fiestas:
+Planes que se adaptan a tí: Puedes apuntarte días sueltos, o elegir entre las varias ofertas por varios días para conseguir descuentos.
+Dormir es de cobardes: Casi todos los días organizamos actividades desde la mañana, ya sean almuerzos, actividades para el público general o competiciones en los Herri Kirolak. Después solemos ir a comer juntos, antes de los paseillos, y después, siempre cenamos juntos. Y por la noche, hasta que el cuerpo aguante!
+Especialistas en paseillos: A la hora de hacer paseillos, no hay quien nos gane. Con nuestra furgoneta siempre abierta a la cabeza, y la txaranga El Postín animando desde atrás, es imposible aburrirse. Y entre paseillos tampoco descansamos, siempre estamos organizando cosas: juegos, carreras, bingos, música, ida a las barracas...
+Nos gusta comer: No queremos que un Margolari pase hambre. Las comidas en Gasteizko Margolariak son en restaurante, con un buen menú, que nos den fuerzas para aguantar el resto del día. Las cenas las hacemos bien en la calle o bien en restaurante, pero siempre con comida buena y caliente. Los mismo que los almuerzos.
+Y beber: Sea cual sea tu veneno, lo tenemos: Ron, vodka, kalimotxo, cerveza, whiskey, agua, refrescos... Durante los paseillos (y varias veces más a lo largo del día) en la furgoneta tendrás barra libre de todo lo que quieras.
+Nos apuntamos a un bombardeo: Carrera de Barricas, Herri Kirolak... Nunca hemos faltado a nada. Ganar, lo que es ganar, aún lo tenemos pendiente, pero lo pasamos bien. Así que ya sabes, si quieres representar a Gasteizko Margolariak, avísanos!
+Por la ciudad, para la ciudad: No nos gusta mirarnos el ombligo. Aunque la mayor parte de actividades que organizamos son para los miembros de Gasteizko Margolariak, hay otras que son para todo el público. Hasta ahora hemos organizado talleres de Cesta Punta para txikis, Margotxef (un concurso de cocina infantil), visitas a residencias de ancianos...
+Margolaris: Todo lo demás no sirve de nada si en una cuadrilla no hay buen ambiente. En Gasteizko Margolariak podemos presumir de gente cercana, participativa, capaz de hacer que desde el primer día ya te sientas como en casa. Además, los organizadores son gente cercana, que escucha y está siempre abierta a nuevas propuestas. Por esto, quien prueba, repite.</string>
+                                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                                    <nil key="textColor"/>
+                                                                    <nil key="highlightedColor"/>
+                                                                </label>
+                                                            </subviews>
+                                                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                            <constraints>
+                                                                <constraint firstItem="JSe-pA-fF3" firstAttribute="width" secondItem="fMm-Rh-0GJ" secondAttribute="width" constant="-16" id="0CL-R7-7P2"/>
+                                                                <constraint firstItem="JSe-pA-fF3" firstAttribute="centerY" secondItem="fMm-Rh-0GJ" secondAttribute="centerY" id="Q89-f8-aOO"/>
+                                                                <constraint firstItem="JSe-pA-fF3" firstAttribute="centerX" secondItem="fMm-Rh-0GJ" secondAttribute="centerX" id="bWM-TD-7eg"/>
+                                                                <constraint firstItem="JSe-pA-fF3" firstAttribute="height" secondItem="fMm-Rh-0GJ" secondAttribute="height" constant="-16" id="v8i-dq-nKb"/>
+                                                            </constraints>
+                                                            <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                                        </view>
+                                                    </subviews>
+                                                    <constraints>
+                                                        <constraint firstItem="fMm-Rh-0GJ" firstAttribute="width" secondItem="61P-J5-lJc" secondAttribute="width" id="1cf-fJ-wVQ"/>
+                                                        <constraint firstItem="fMm-Rh-0GJ" firstAttribute="height" secondItem="61P-J5-lJc" secondAttribute="height" id="TW5-ca-9gB"/>
+                                                        <constraint firstItem="fMm-Rh-0GJ" firstAttribute="centerY" secondItem="61P-J5-lJc" secondAttribute="centerY" id="bNf-OB-OIC"/>
+                                                        <constraint firstItem="fMm-Rh-0GJ" firstAttribute="centerX" secondItem="61P-J5-lJc" secondAttribute="centerX" id="fUF-Fq-9fs"/>
+                                                    </constraints>
+                                                </stackView>
+                                            </subviews>
+                                            <color key="backgroundColor" red="0.59607843137254901" green="0.78431372549019607" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                            <constraints>
+                                                <constraint firstItem="rbu-EN-1UC" firstAttribute="width" secondItem="ANk-4K-DBn" secondAttribute="width" id="2rM-dk-8qK"/>
+                                                <constraint firstItem="61P-J5-lJc" firstAttribute="top" secondItem="rbu-EN-1UC" secondAttribute="bottom" id="8zQ-01-cy2"/>
+                                                <constraint firstItem="rbu-EN-1UC" firstAttribute="top" secondItem="ANk-4K-DBn" secondAttribute="top" id="EtJ-4V-V4H"/>
+                                                <constraint firstAttribute="bottom" secondItem="61P-J5-lJc" secondAttribute="bottom" id="H19-rV-6q8"/>
+                                                <constraint firstItem="rbu-EN-1UC" firstAttribute="centerX" secondItem="ANk-4K-DBn" secondAttribute="centerX" id="YlB-Dt-nSZ"/>
+                                                <constraint firstItem="61P-J5-lJc" firstAttribute="width" secondItem="ANk-4K-DBn" secondAttribute="width" id="c8o-RP-PLt"/>
+                                                <constraint firstItem="61P-J5-lJc" firstAttribute="centerX" secondItem="ANk-4K-DBn" secondAttribute="centerX" id="xOL-wr-htu"/>
+                                            </constraints>
+                                            <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                            <userDefinedRuntimeAttributes>
+                                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                    <integer key="value" value="8"/>
+                                                </userDefinedRuntimeAttribute>
+                                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                    <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                </userDefinedRuntimeAttribute>
+                                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                    <real key="value" value="1"/>
+                                                </userDefinedRuntimeAttribute>
+                                            </userDefinedRuntimeAttributes>
+                                        </view>
+                                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="O30-vI-Tga" userLabel="Festivals">
+                                            <rect key="frame" x="10" y="10" width="355" height="1235.5"/>
+                                            <subviews>
+                                                <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="zWn-KM-9py">
+                                                    <rect key="frame" x="0.0" y="0.0" width="355" height="1235.5"/>
+                                                    <subviews>
+                                                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Trj-oS-RaI" userLabel="FestivalsIntro">
+                                                            <rect key="frame" x="0.0" y="0.0" width="355" height="300"/>
+                                                            <subviews>
+                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="FTitle" text="Festivals" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Uf0-CR-dfk" userLabel="FTitle">
+                                                                    <rect key="frame" x="0.0" y="0.0" width="355" height="30"/>
+                                                                    <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="30" id="sgD-kx-5ct"/>
+                                                                    </constraints>
+                                                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                                                    <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                    <nil key="highlightedColor"/>
+                                                                </label>
+                                                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="61f-V8-Jtw">
+                                                                    <rect key="frame" x="54" y="40" width="248" height="128"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="128" id="V4f-jX-8vE"/>
+                                                                    </constraints>
+                                                                </imageView>
+                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tlF-oW-fKA">
+                                                                    <rect key="frame" x="8" y="178" width="339" height="122"/>
+                                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                                    <nil key="textColor"/>
+                                                                    <nil key="highlightedColor"/>
+                                                                </label>
+                                                            </subviews>
+                                                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                            <constraints>
+                                                                <constraint firstItem="Uf0-CR-dfk" firstAttribute="centerX" secondItem="Trj-oS-RaI" secondAttribute="centerX" id="5O9-6v-OI1"/>
+                                                                <constraint firstItem="tlF-oW-fKA" firstAttribute="centerX" secondItem="Trj-oS-RaI" secondAttribute="centerX" id="Bcv-eN-x8B"/>
+                                                                <constraint firstAttribute="bottom" secondItem="tlF-oW-fKA" secondAttribute="bottom" id="EHV-kx-BN2"/>
+                                                                <constraint firstItem="61f-V8-Jtw" firstAttribute="top" secondItem="Uf0-CR-dfk" secondAttribute="bottom" constant="10" id="GQH-En-4OI"/>
+                                                                <constraint firstItem="tlF-oW-fKA" firstAttribute="width" secondItem="Trj-oS-RaI" secondAttribute="width" constant="-16" id="JA6-j0-5rF"/>
+                                                                <constraint firstAttribute="height" constant="300" id="JPq-O2-Eee"/>
+                                                                <constraint firstItem="tlF-oW-fKA" firstAttribute="top" secondItem="61f-V8-Jtw" secondAttribute="bottom" constant="10" id="JyT-sH-rLA"/>
+                                                                <constraint firstItem="61f-V8-Jtw" firstAttribute="centerX" secondItem="Trj-oS-RaI" secondAttribute="centerX" id="MPp-Uj-J5D"/>
+                                                                <constraint firstItem="Uf0-CR-dfk" firstAttribute="width" secondItem="Trj-oS-RaI" secondAttribute="width" id="hig-ZM-Oul"/>
+                                                                <constraint firstItem="61f-V8-Jtw" firstAttribute="width" secondItem="Trj-oS-RaI" secondAttribute="width" multiplier="0.7" id="kTa-D1-266"/>
+                                                                <constraint firstItem="Uf0-CR-dfk" firstAttribute="top" secondItem="Trj-oS-RaI" secondAttribute="top" id="ljp-1E-Lap"/>
+                                                            </constraints>
+                                                            <userDefinedRuntimeAttributes>
+                                                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                    <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                    <real key="value" value="1"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                    <real key="value" value="8"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                            </userDefinedRuntimeAttributes>
+                                                        </view>
+                                                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Et3-gn-ciE" userLabel="FestivalsButtons">
+                                                            <rect key="frame" x="0.0" y="310" width="355" height="90"/>
+                                                            <subviews>
+                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="FesivalsButtonTitle" text=" Programas de Fiestas" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="w8k-rj-iYK" userLabel="FesivalsButtonTitle">
+                                                                    <rect key="frame" x="0.0" y="0.0" width="355" height="30"/>
+                                                                    <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="30" id="jb7-xf-xmS"/>
+                                                                    </constraints>
+                                                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                                                    <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                    <nil key="highlightedColor"/>
+                                                                </label>
+                                                                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LqL-cc-rQ7" userLabel="BtSchedule">
+                                                                    <rect key="frame" x="10" y="40" width="162.5" height="40"/>
+                                                                    <color key="backgroundColor" red="0.070588235294117646" green="0.27058823529411763" blue="0.40392156862745099" alpha="1" colorSpace="calibratedRGB"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="40" id="K47-KO-8oN"/>
+                                                                    </constraints>
+                                                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
+                                                                    <state key="normal" title="Programa de fiestas">
+                                                                        <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                    </state>
+                                                                    <userDefinedRuntimeAttributes>
+                                                                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                            <real key="value" value="2"/>
+                                                                        </userDefinedRuntimeAttribute>
+                                                                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                            <color key="value" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                        </userDefinedRuntimeAttribute>
+                                                                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                            <real key="value" value="4"/>
+                                                                        </userDefinedRuntimeAttribute>
+                                                                    </userDefinedRuntimeAttributes>
+                                                                </button>
+                                                                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="sX5-OY-Jg0" userLabel="BtGMSchedule">
+                                                                    <rect key="frame" x="182.5" y="40" width="162.5" height="40"/>
+                                                                    <color key="backgroundColor" red="0.070588235289999995" green="0.27058823529999998" blue="0.4039215686" alpha="1" colorSpace="calibratedRGB"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="40" id="4YB-v3-Cwb"/>
+                                                                    </constraints>
+                                                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
+                                                                    <state key="normal" title="Programa Margolari">
+                                                                        <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                    </state>
+                                                                    <userDefinedRuntimeAttributes>
+                                                                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                            <color key="value" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                        </userDefinedRuntimeAttribute>
+                                                                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                            <real key="value" value="2"/>
+                                                                        </userDefinedRuntimeAttribute>
+                                                                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                            <real key="value" value="4"/>
+                                                                        </userDefinedRuntimeAttribute>
+                                                                    </userDefinedRuntimeAttributes>
+                                                                </button>
+                                                            </subviews>
+                                                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                            <constraints>
+                                                                <constraint firstAttribute="trailing" secondItem="sX5-OY-Jg0" secondAttribute="trailing" constant="10" id="4ZI-Ic-udM"/>
+                                                                <constraint firstItem="LqL-cc-rQ7" firstAttribute="top" secondItem="w8k-rj-iYK" secondAttribute="bottom" constant="10" id="6U5-ki-vCh"/>
+                                                                <constraint firstItem="w8k-rj-iYK" firstAttribute="top" secondItem="Et3-gn-ciE" secondAttribute="top" id="Eor-ww-lgP"/>
+                                                                <constraint firstItem="w8k-rj-iYK" firstAttribute="width" secondItem="Et3-gn-ciE" secondAttribute="width" id="JWv-RV-UNi"/>
+                                                                <constraint firstItem="w8k-rj-iYK" firstAttribute="centerX" secondItem="Et3-gn-ciE" secondAttribute="centerX" id="SFa-f4-np8"/>
+                                                                <constraint firstItem="LqL-cc-rQ7" firstAttribute="leading" secondItem="Et3-gn-ciE" secondAttribute="leading" constant="10" id="Sju-dg-kBM"/>
+                                                                <constraint firstItem="sX5-OY-Jg0" firstAttribute="width" secondItem="Et3-gn-ciE" secondAttribute="width" multiplier="0.5" constant="-15" id="mRb-Ng-Lhq"/>
+                                                                <constraint firstItem="LqL-cc-rQ7" firstAttribute="width" secondItem="Et3-gn-ciE" secondAttribute="width" multiplier="0.5" constant="-15" id="p0W-yy-k4Z"/>
+                                                                <constraint firstItem="sX5-OY-Jg0" firstAttribute="top" secondItem="w8k-rj-iYK" secondAttribute="bottom" constant="10" id="vP0-hV-IAL"/>
+                                                                <constraint firstAttribute="bottom" secondItem="LqL-cc-rQ7" secondAttribute="bottom" constant="10" id="yFw-lf-zhl"/>
+                                                            </constraints>
+                                                            <userDefinedRuntimeAttributes>
+                                                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                    <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                    <real key="value" value="1"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                    <real key="value" value="8"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                            </userDefinedRuntimeAttributes>
+                                                        </view>
+                                                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="feb-ob-HAK" userLabel="FestivalsPrices">
+                                                            <rect key="frame" x="0.0" y="410" width="355" height="825.5"/>
+                                                            <subviews>
+                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Programas de Fiestas" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="swA-jU-3wo" userLabel="FesivalsPricesTitle">
+                                                                    <rect key="frame" x="0.0" y="0.0" width="355" height="30"/>
+                                                                    <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="30" id="chr-L8-aT9"/>
+                                                                    </constraints>
+                                                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                                                    <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                    <nil key="highlightedColor"/>
+                                                                </label>
+                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Ofertas" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uns-Lv-yfZ">
+                                                                    <rect key="frame" x="8" y="40" width="339" height="20"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="20" id="lCP-xA-gT6"/>
+                                                                    </constraints>
+                                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                                    <nil key="textColor"/>
+                                                                    <nil key="highlightedColor"/>
+                                                                </label>
+                                                                <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="rcX-IS-Hmj" userLabel="StackOffers">
+                                                                    <rect key="frame" x="13" y="70" width="330" height="200"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="200" id="YNZ-ap-Ful"/>
+                                                                    </constraints>
+                                                                </stackView>
+                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Dias sueltos" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xp7-EC-6OW">
+                                                                    <rect key="frame" x="8" y="285" width="339" height="20.5"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="20" id="Ecc-N8-k3S"/>
+                                                                    </constraints>
+                                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                                    <nil key="textColor"/>
+                                                                    <nil key="highlightedColor"/>
+                                                                </label>
+                                                                <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="qKn-wk-VDT" userLabel="StackDays">
+                                                                    <rect key="frame" x="12.5" y="315.5" width="330" height="510"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="510" id="Hzw-0S-h69"/>
+                                                                    </constraints>
+                                                                </stackView>
+                                                            </subviews>
+                                                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                            <constraints>
+                                                                <constraint firstItem="swA-jU-3wo" firstAttribute="top" secondItem="feb-ob-HAK" secondAttribute="top" id="7hg-wz-EVN"/>
+                                                                <constraint firstItem="xp7-EC-6OW" firstAttribute="top" secondItem="rcX-IS-Hmj" secondAttribute="bottom" constant="15" id="EiC-Rv-Dog"/>
+                                                                <constraint firstItem="xp7-EC-6OW" firstAttribute="width" secondItem="feb-ob-HAK" secondAttribute="width" constant="-16" id="Gg5-Ev-py5"/>
+                                                                <constraint firstItem="swA-jU-3wo" firstAttribute="width" secondItem="feb-ob-HAK" secondAttribute="width" id="Gj1-HV-kbf"/>
+                                                                <constraint firstItem="xp7-EC-6OW" firstAttribute="centerX" secondItem="feb-ob-HAK" secondAttribute="centerX" id="HFH-0V-hcn"/>
+                                                                <constraint firstItem="rcX-IS-Hmj" firstAttribute="width" secondItem="feb-ob-HAK" secondAttribute="width" constant="-25" id="LZk-qS-h9h"/>
+                                                                <constraint firstItem="uns-Lv-yfZ" firstAttribute="top" secondItem="swA-jU-3wo" secondAttribute="bottom" constant="10" id="MKr-Mb-eal"/>
+                                                                <constraint firstItem="swA-jU-3wo" firstAttribute="centerX" secondItem="feb-ob-HAK" secondAttribute="centerX" id="P9O-ov-JFT"/>
+                                                                <constraint firstAttribute="bottom" secondItem="qKn-wk-VDT" secondAttribute="bottom" id="QX5-ch-qgu"/>
+                                                                <constraint firstItem="qKn-wk-VDT" firstAttribute="top" secondItem="xp7-EC-6OW" secondAttribute="bottom" constant="10" id="Sux-3A-CZI"/>
+                                                                <constraint firstItem="uns-Lv-yfZ" firstAttribute="centerX" secondItem="feb-ob-HAK" secondAttribute="centerX" id="U1R-CZ-rX8"/>
+                                                                <constraint firstItem="qKn-wk-VDT" firstAttribute="width" secondItem="feb-ob-HAK" secondAttribute="width" constant="-25" id="ZqJ-Od-UHh"/>
+                                                                <constraint firstItem="rcX-IS-Hmj" firstAttribute="centerX" secondItem="feb-ob-HAK" secondAttribute="centerX" id="cse-q8-LIE"/>
+                                                                <constraint firstItem="qKn-wk-VDT" firstAttribute="centerX" secondItem="feb-ob-HAK" secondAttribute="centerX" id="gFE-CG-zYE"/>
+                                                                <constraint firstItem="uns-Lv-yfZ" firstAttribute="width" secondItem="feb-ob-HAK" secondAttribute="width" constant="-16" id="h4H-Rv-cUV"/>
+                                                                <constraint firstItem="rcX-IS-Hmj" firstAttribute="top" secondItem="uns-Lv-yfZ" secondAttribute="bottom" constant="10" id="vx7-Lg-abI"/>
+                                                            </constraints>
+                                                            <userDefinedRuntimeAttributes>
+                                                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                    <real key="value" value="8"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                    <real key="value" value="1"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                    <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                            </userDefinedRuntimeAttributes>
+                                                        </view>
+                                                    </subviews>
+                                                    <constraints>
+                                                        <constraint firstItem="Et3-gn-ciE" firstAttribute="centerX" secondItem="zWn-KM-9py" secondAttribute="centerX" id="5SW-vB-DAm"/>
+                                                        <constraint firstItem="Et3-gn-ciE" firstAttribute="top" secondItem="Trj-oS-RaI" secondAttribute="bottom" constant="10" id="GcZ-Be-MrS"/>
+                                                        <constraint firstItem="Et3-gn-ciE" firstAttribute="width" secondItem="zWn-KM-9py" secondAttribute="width" id="TAv-Wh-Gec"/>
+                                                        <constraint firstItem="Trj-oS-RaI" firstAttribute="centerX" secondItem="zWn-KM-9py" secondAttribute="centerX" id="clD-T1-Ga1"/>
+                                                        <constraint firstItem="Trj-oS-RaI" firstAttribute="width" secondItem="zWn-KM-9py" secondAttribute="width" id="oQW-7X-eiK"/>
+                                                        <constraint firstItem="Trj-oS-RaI" firstAttribute="top" secondItem="zWn-KM-9py" secondAttribute="top" id="rC2-7C-RUH"/>
+                                                    </constraints>
+                                                </stackView>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstItem="zWn-KM-9py" firstAttribute="centerX" secondItem="O30-vI-Tga" secondAttribute="centerX" id="BCL-JB-6el"/>
+                                                <constraint firstItem="zWn-KM-9py" firstAttribute="height" secondItem="O30-vI-Tga" secondAttribute="height" id="ENO-ft-pka"/>
+                                                <constraint firstItem="zWn-KM-9py" firstAttribute="width" secondItem="O30-vI-Tga" secondAttribute="width" id="fQa-AU-a1J"/>
+                                                <constraint firstItem="zWn-KM-9py" firstAttribute="centerY" secondItem="O30-vI-Tga" secondAttribute="centerY" id="tTv-jp-vug"/>
+                                            </constraints>
+                                            <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                            <userDefinedRuntimeAttributes>
+                                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                    <real key="value" value="0.0"/>
+                                                </userDefinedRuntimeAttribute>
+                                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                    <real key="value" value="0.0"/>
+                                                </userDefinedRuntimeAttribute>
+                                            </userDefinedRuntimeAttributes>
+                                        </view>
+                                    </subviews>
+                                    <constraints>
+                                        <constraint firstItem="ANk-4K-DBn" firstAttribute="centerY" secondItem="1tl-Rf-vmM" secondAttribute="centerY" id="32h-Uf-A6O"/>
+                                        <constraint firstItem="O30-vI-Tga" firstAttribute="width" secondItem="1tl-Rf-vmM" secondAttribute="width" constant="-20" id="H6i-C0-iLl"/>
+                                        <constraint firstItem="O30-vI-Tga" firstAttribute="centerY" secondItem="1tl-Rf-vmM" secondAttribute="centerY" id="UM4-RM-fCP"/>
+                                        <constraint firstItem="ANk-4K-DBn" firstAttribute="height" secondItem="1tl-Rf-vmM" secondAttribute="height" constant="-20" id="X9l-D2-wpr"/>
+                                        <constraint firstItem="O30-vI-Tga" firstAttribute="centerX" secondItem="1tl-Rf-vmM" secondAttribute="centerX" id="bcV-jn-OzN"/>
+                                        <constraint firstItem="ANk-4K-DBn" firstAttribute="width" secondItem="1tl-Rf-vmM" secondAttribute="width" constant="-20" id="g3J-QI-uUU"/>
+                                        <constraint firstItem="ANk-4K-DBn" firstAttribute="centerX" secondItem="1tl-Rf-vmM" secondAttribute="centerX" id="hc3-iw-a9J"/>
+                                        <constraint firstItem="O30-vI-Tga" firstAttribute="height" secondItem="1tl-Rf-vmM" secondAttribute="height" constant="-20" id="neE-NI-yZa"/>
+                                    </constraints>
+                                    <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                </view>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="1tl-Rf-vmM" firstAttribute="centerY" secondItem="onh-i9-8Tz" secondAttribute="centerY" id="Eom-1v-GO4"/>
+                                <constraint firstAttribute="bottom" secondItem="1tl-Rf-vmM" secondAttribute="bottom" id="H5Q-1i-OhR"/>
+                                <constraint firstItem="1tl-Rf-vmM" firstAttribute="width" secondItem="onh-i9-8Tz" secondAttribute="width" id="LTx-LP-2dU"/>
+                                <constraint firstItem="1tl-Rf-vmM" firstAttribute="top" secondItem="onh-i9-8Tz" secondAttribute="top" id="gM1-dS-jWM"/>
+                                <constraint firstItem="1tl-Rf-vmM" firstAttribute="centerX" secondItem="onh-i9-8Tz" secondAttribute="centerX" id="yyZ-Mm-MFj"/>
+                            </constraints>
+                        </stackView>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="onh-i9-8Tz" firstAttribute="top" secondItem="tXE-yu-DoB" secondAttribute="top" id="CrY-e7-Nd6"/>
+                        <constraint firstAttribute="trailing" secondItem="onh-i9-8Tz" secondAttribute="trailing" id="F0Q-kD-nwz"/>
+                        <constraint firstItem="onh-i9-8Tz" firstAttribute="width" secondItem="tXE-yu-DoB" secondAttribute="width" id="VNo-3N-w64"/>
+                        <constraint firstItem="onh-i9-8Tz" firstAttribute="leading" secondItem="tXE-yu-DoB" secondAttribute="leading" id="VXj-xp-cWQ"/>
+                        <constraint firstAttribute="bottom" secondItem="onh-i9-8Tz" secondAttribute="bottom" id="uCE-No-aOq"/>
+                    </constraints>
+                </scrollView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="tXE-yu-DoB" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="5nP-Qg-R0K"/>
+                <constraint firstItem="tXE-yu-DoB" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="Adi-zS-UK6"/>
+                <constraint firstItem="tXE-yu-DoB" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="XCC-J5-qrD"/>
+                <constraint firstItem="tXE-yu-DoB" firstAttribute="height" secondItem="iN0-l3-epB" secondAttribute="height" id="g1W-BK-3Nv"/>
+            </constraints>
+        </view>
+    </objects>
+    <resources>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
+</document>

+ 158 - 0
app/PostViewController.swift

@@ -0,0 +1,158 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import UIKit
+import CoreData
+
+/**
+The view controller of the app.
+*/
+class PostViewController: UIViewController, UIGestureRecognizerDelegate {
+	
+
+	
+	@IBOutlet weak var barTitle: UILabel!
+	@IBOutlet weak var barButton: UIButton!
+	@IBOutlet weak var postText: UILabel!
+	@IBOutlet weak var postTitle: UILabel!
+	@IBOutlet weak var postImage: UIImageView!
+	var id: Int = -1
+	var delegate: AppDelegate?
+	
+	//Each of the sections of the app.
+	
+	var passId: Int = -1
+	
+	func getContext () -> NSManagedObjectContext {
+		//let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		//return appDelegate.persistentContainer.viewContext
+		return NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
+	}
+	
+	/**
+	Run when the app loads.
+	*/
+	override func viewDidLoad() {
+		
+		print("POSTCONTROLLER:LOG: viewDidLoad()")
+		
+		super.viewDidLoad()
+		self.loadPost(id: id)
+		
+		// Set button action
+		barButton.addTarget(self, action: #selector(self.back), for: .touchUpInside)
+	}
+	
+	//TODO implement all the logic for post loading here, including iboutlts
+	
+	
+	func back() {
+		print("POSTCONTROLLER:DEBUG: Back")
+		self.dismiss(animated: true, completion: nil)
+	}
+	
+	
+	/**
+	Dispose of any resources that can be recreated.
+	*/
+	override func didReceiveMemoryWarning() {
+		super.didReceiveMemoryWarning()
+	}
+	
+	public func loadPost(id: Int){
+		
+		print("POSTCONTROLLER:DEBUG: Loading post \(id)")
+		
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let lang : String = getLanguage()
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		let fetchRequest: NSFetchRequest<Post> = Post.fetchRequest()
+		fetchRequest.predicate = NSPredicate(format: "id = %i", id)
+		
+		do {
+			//go get the results
+			let searchResults = try context.fetch(fetchRequest)
+			
+			var count = 0
+			var sTitle: String
+			var sText: String
+			var image: String
+			
+			//You need to convert to NSManagedObject to use 'for' loops
+			for r in searchResults as [NSManagedObject] {
+				count = count + 1
+				
+				sTitle = r.value(forKey: "title_\(lang)")! as! String
+				sText = r.value(forKey: "text_\(lang)")! as! String
+				postTitle.text = "  \(sTitle)"
+				postText.text = sText.stripHtml()
+				
+				// Get main image
+				image = ""
+				let imgFetchRequest: NSFetchRequest<Post_image> = Post_image.fetchRequest()
+				let imgSortDescriptor = NSSortDescriptor(key: "idx", ascending: true)
+				let imgSortDescriptors = [imgSortDescriptor]
+				imgFetchRequest.sortDescriptors = imgSortDescriptors
+				imgFetchRequest.predicate = NSPredicate(format: "post == %i", id)
+				imgFetchRequest.fetchLimit = 1
+				//TODO get more images
+				do{
+					let imgSearchResults = try context.fetch(imgFetchRequest)
+					for imgR in imgSearchResults as [NSManagedObject]{
+						image = imgR.value(forKey: "image")! as! String
+						print ("POST:LOG: Image: \(image)")
+						//TODO set image
+						//row.setImage(filename: image)
+					}
+				} catch {
+					print("POST:ERROR: Error getting image for post \(id): \(error)")
+				}
+				
+			}
+		} catch {
+			print("POST:ERROR: Error with request: \(error)")
+		}
+		
+		//Always at the end: update scrollview
+		// TODOs
+		//var h: Int = 0
+		//for view in scrollView.subviews {
+			//contentRect = contentRect.union(view.frame);
+		//	h = h + Int(view.frame.height) + 30 //Why 30?
+		//}
+		//print("POST:DEBUG: Height: \(h)")
+		// TODO: Calculate at the end
+		//self.scrollView.contentSize.height = 4500//CGFloat(h);
+
+	}
+	
+	func getLanguage() -> String{
+		let pre = NSLocale.preferredLanguages[0].subStr(start: 0, end: 1)
+		if(pre == "es" || pre == "en" || pre == "eu"){
+			return pre
+		}
+		else{
+			return "es"
+		}
+	}
+	
+}
+

+ 130 - 0
app/RowAlbum.swift

@@ -0,0 +1,130 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowAlbum: UIView {
+	
+	// Outlets
+	@IBOutlet weak var container: UIView!
+	@IBOutlet weak var photo0: UIImageView!
+	@IBOutlet weak var photo1: UIImageView!
+
+	
+	// Album ID
+	var id = -1
+	
+	// This view
+	var v: UIView!
+	
+	// Array with the imageviews
+	var preview: [UIImageView] = []
+
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	/**
+	Loads the view from the xib with the same name as the class.
+	*/
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+		
+		v = self
+		self.frame = self.bounds
+		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		self.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = self.bounds
+		self.addSubview(container)
+
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		NSLog(":ROWALBUM:DEBUG: Init \(s), \(i)")
+		
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		v = self
+		self.frame = self.bounds
+		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		self.translatesAutoresizingMaskIntoConstraints = true
+		
+		//Populate review array
+		preview = [photo0, photo1]
+		
+		// Set tap recognizers
+		// TODO
+		//let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (RowAlbum.openPhoto(_:)))
+		//tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+		//self.addGestureRecognizer(tapRecognizer)
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	func openPhoto(_ sender:UITapGestureRecognizer? = nil){
+		NSLog(":ROWALBUM:DEBUG: Getting delegate and showing photo.")
+		// TODO
+		//let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		//delegate.controller?.showAlbum(id: self.id)
+	}
+	
+	/**
+	Changes the preview image of the photos.
+	If null or empty, the igage is hidden.
+	:param: idx Id of the image in the row. 0 for left, 1 for right.
+	:param: filename Filename of the image.
+	*/
+	func setImage(idx: Int, filename: String){
+		if (filename == ""){
+			NSLog(":ROWALBUM:DEBUG: No image for album \(self.id) at index \(idx).")
+			preview[idx].isHidden = true
+			//TODO hide the imageview
+		}
+		else{
+			NSLog(":ROWALBUM:DEBUG: Set image \(filename) for at index \(idx).")
+			let path = "img/galeria/thumb/\(filename)"
+			preview[idx].setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+		}
+	}
+	
+}

+ 81 - 0
app/RowAlbum.xib

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowAlbum" customModule="app" customModuleProvider="target">
+            <connections>
+                <outlet property="container" destination="HdV-Po-yYe" id="J6E-n0-STQ"/>
+                <outlet property="photo0" destination="STJ-Gn-fSb" id="KnJ-xP-W5E"/>
+                <outlet property="photo1" destination="BRb-br-Rb9" id="GSz-Ba-URb"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" userLabel="RowAlbum" customClass="RowAlbum" customModule="app">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HdV-Po-yYe">
+                    <rect key="frame" x="-0.5" y="269" width="375" height="128"/>
+                    <subviews>
+                        <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="STJ-Gn-fSb" userLabel="PhotoL">
+                            <rect key="frame" x="10" y="10" width="172.5" height="108"/>
+                            <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="108" id="adJ-vY-QZ4"/>
+                            </constraints>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <real key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </imageView>
+                        <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="BRb-br-Rb9" userLabel="PhotoR">
+                            <rect key="frame" x="192.5" y="10" width="172.5" height="108"/>
+                            <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="108" id="LVi-0V-kFe"/>
+                            </constraints>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <real key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </imageView>
+                    </subviews>
+                    <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                    <constraints>
+                        <constraint firstItem="STJ-Gn-fSb" firstAttribute="width" secondItem="HdV-Po-yYe" secondAttribute="width" multiplier="0.5" constant="-15" id="4OG-wC-zDi"/>
+                        <constraint firstAttribute="trailing" secondItem="BRb-br-Rb9" secondAttribute="trailing" constant="10" id="52p-oq-lor"/>
+                        <constraint firstItem="BRb-br-Rb9" firstAttribute="centerY" secondItem="HdV-Po-yYe" secondAttribute="centerY" id="BdD-2d-ZcG"/>
+                        <constraint firstItem="STJ-Gn-fSb" firstAttribute="leading" secondItem="HdV-Po-yYe" secondAttribute="leading" constant="10" id="DAf-JG-dgr"/>
+                        <constraint firstItem="STJ-Gn-fSb" firstAttribute="centerY" secondItem="HdV-Po-yYe" secondAttribute="centerY" id="LpQ-Cf-UpA"/>
+                        <constraint firstItem="BRb-br-Rb9" firstAttribute="width" secondItem="HdV-Po-yYe" secondAttribute="width" multiplier="0.5" constant="-15" id="hFK-eR-Cdf"/>
+                        <constraint firstAttribute="height" constant="128" id="i8w-5X-QWB"/>
+                    </constraints>
+                </view>
+            </subviews>
+            <constraints>
+                <constraint firstItem="HdV-Po-yYe" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="4Aa-Fb-Ugf"/>
+                <constraint firstItem="HdV-Po-yYe" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="bFu-54-Zel"/>
+                <constraint firstItem="HdV-Po-yYe" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="jRe-xq-gcl"/>
+            </constraints>
+        </view>
+    </objects>
+    <resources>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
+</document>

+ 130 - 0
app/RowBlog.swift

@@ -0,0 +1,130 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowBlog: UIView {
+	
+	//This view
+	var v: UIView!
+	
+	//The container.
+	@IBOutlet weak var container: UIView!
+	
+	//The entry
+	@IBOutlet weak var entry: UIView!
+
+	//The post title.
+	@IBOutlet weak var title: UILabel!
+	
+	//The post description.
+	@IBOutlet weak var descrip: UILabel!
+
+	//The post image.
+	@IBOutlet weak var image: UIImageView!
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		v = self
+		v.frame = bounds
+		v.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		v.translatesAutoresizingMaskIntoConstraints = true
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = v.bounds
+		v.addSubview(container)
+		
+		// Set tap recognizer
+		/*print("ROW_BLOG:DEBUG: set tap recognizer")
+		let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (self.openPost (_:)))
+		tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+		addGestureRecognizer(tapRecognizer)*/
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+
+	
+	/**
+	Changes the title of the post. Decodes HTML.
+	:param: text The new title.
+	*/
+	func setTitle(text: String){
+		title.text = text.stripHtml()
+	}
+	
+	/**
+	Changes the description of the post. Decodes HTML.
+	:param: text The new text.
+	*/
+	func setText(text: String){
+		descrip.text = text.stripHtml()
+	}
+	
+	/**
+	Changes the image of the post.
+	If null or empty, the igage is hidden.
+	:param: path The new text.
+	*/
+	func setImage(filename: String){
+		if (filename == ""){
+			print("No image")
+			//TODO hide the imageview
+		}
+		else{
+			print("Set image \(filename)")
+			let path = "img/blog/thumb/\(filename)"
+			image.setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+		}
+	}
+	
+	func openPost(_ sender:UITapGestureRecognizer? = nil){
+		print("ROW_BLOG:DEBUG: openpost")
+	}
+}

+ 113 - 0
app/RowBlog.xib

@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowBlog" customModule="app" customModuleProvider="target">
+            <connections>
+                <outlet property="container" destination="fIu-6X-Tsy" id="sdT-5k-azi"/>
+                <outlet property="descrip" destination="rzM-vF-gOY" id="uQp-Za-gam"/>
+                <outlet property="entry" destination="b17-mq-rbm" id="3Ac-n2-qLr"/>
+                <outlet property="image" destination="6hA-MD-OsD" id="VNd-1E-Ztc"/>
+                <outlet property="title" destination="WSL-LM-04R" id="qKn-Xk-cEN"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="yLg-4E-qlC" userLabel="RowBlog" customClass="RowBlog" customModule="app">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fIu-6X-Tsy" userLabel="Container">
+                    <rect key="frame" x="0.0" y="273.5" width="375" height="120"/>
+                    <subviews>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="b17-mq-rbm" userLabel="Entry">
+                            <rect key="frame" x="10" y="10" width="355" height="120"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WSL-LM-04R" userLabel="Title">
+                                    <rect key="frame" x="10" y="10" width="335" height="22"/>
+                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+                                    <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="6hA-MD-OsD" userLabel="Image">
+                                    <rect key="frame" x="10" y="40" width="71" height="64"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="64" id="68z-jj-fIa"/>
+                                    </constraints>
+                                </imageView>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rzM-vF-gOY" userLabel="Text">
+                                    <rect key="frame" x="97" y="40" width="248" height="21"/>
+                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <nil key="textColor"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                            </subviews>
+                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                            <constraints>
+                                <constraint firstItem="WSL-LM-04R" firstAttribute="top" secondItem="b17-mq-rbm" secondAttribute="top" constant="10" id="4og-BI-wpQ"/>
+                                <constraint firstItem="6hA-MD-OsD" firstAttribute="width" secondItem="b17-mq-rbm" secondAttribute="width" multiplier="0.2" id="BYW-Hr-dje"/>
+                                <constraint firstItem="rzM-vF-gOY" firstAttribute="top" secondItem="b17-mq-rbm" secondAttribute="top" constant="40" id="O3L-O9-b6V"/>
+                                <constraint firstItem="6hA-MD-OsD" firstAttribute="leading" secondItem="b17-mq-rbm" secondAttribute="leading" constant="10" id="gNm-O7-qNU"/>
+                                <constraint firstItem="6hA-MD-OsD" firstAttribute="top" secondItem="b17-mq-rbm" secondAttribute="top" constant="40" id="mvQ-pc-ApL"/>
+                                <constraint firstAttribute="trailing" secondItem="WSL-LM-04R" secondAttribute="trailing" constant="10" id="pco-U6-EWQ"/>
+                                <constraint firstItem="WSL-LM-04R" firstAttribute="leading" secondItem="b17-mq-rbm" secondAttribute="leading" constant="10" id="trs-wK-NuZ"/>
+                                <constraint firstAttribute="trailing" secondItem="rzM-vF-gOY" secondAttribute="trailing" constant="10" id="vlK-IJ-OrY"/>
+                                <constraint firstItem="rzM-vF-gOY" firstAttribute="width" secondItem="b17-mq-rbm" secondAttribute="width" multiplier="0.7" id="ww4-WB-msV"/>
+                            </constraints>
+                            <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" red="0.42745098040000001" green="0.41176470590000003" blue="0.56470588239999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <real key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <real key="value" value="3"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="b17-mq-rbm" firstAttribute="leading" secondItem="fIu-6X-Tsy" secondAttribute="leading" constant="10" id="09K-4S-bco"/>
+                        <constraint firstAttribute="top" secondItem="b17-mq-rbm" secondAttribute="top" constant="-10" id="DRs-NG-UKY"/>
+                        <constraint firstAttribute="trailing" secondItem="b17-mq-rbm" secondAttribute="trailing" constant="10" id="Qtu-G3-8IH"/>
+                        <constraint firstAttribute="height" constant="120" id="W85-Qc-MWb"/>
+                        <constraint firstItem="b17-mq-rbm" firstAttribute="bottom" secondItem="fIu-6X-Tsy" secondAttribute="bottom" constant="10" id="bcY-vf-soX"/>
+                    </constraints>
+                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                            <real key="value" value="0.0"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
+                </view>
+            </subviews>
+            <constraints>
+                <constraint firstItem="fIu-6X-Tsy" firstAttribute="width" secondItem="yLg-4E-qlC" secondAttribute="width" id="6xh-OR-L3E"/>
+                <constraint firstItem="fIu-6X-Tsy" firstAttribute="centerX" secondItem="yLg-4E-qlC" secondAttribute="centerX" id="Rel-sh-SrL"/>
+                <constraint firstItem="fIu-6X-Tsy" firstAttribute="centerY" secondItem="yLg-4E-qlC" secondAttribute="centerY" id="X8l-Z5-R9M"/>
+            </constraints>
+            <nil key="simulatedStatusBarMetrics"/>
+            <userDefinedRuntimeAttributes>
+                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                    <real key="value" value="0.0"/>
+                </userDefinedRuntimeAttribute>
+            </userDefinedRuntimeAttributes>
+            <connections>
+                <outlet property="image" destination="6hA-MD-OsD" id="AvA-3b-lxb"/>
+            </connections>
+            <point key="canvasLocation" x="45.5" y="-43.5"/>
+        </view>
+    </objects>
+    <resources>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
+</document>

+ 132 - 0
app/RowGallery.swift

@@ -0,0 +1,132 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowGallery: UIView {
+	
+	// This view
+	var v: UIView!
+	
+	// Outlets
+	@IBOutlet weak var container: UIView!
+	@IBOutlet weak var title: UILabel!
+	@IBOutlet weak var photo0: UIImageView!
+	@IBOutlet weak var photo1: UIImageView!
+	@IBOutlet weak var photo2: UIImageView!
+	@IBOutlet weak var photo3: UIImageView!
+	
+	// Array with the imageviews
+	var preview: [UIImageView] = []
+	
+	// Album ID
+	var id = -1
+	
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	/**
+	Loads the view from the xib with the same name as the class.
+	*/
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		NSLog(":ROWGALLERY:DEBUG: Init \(s), \(i)")
+		
+		super.init(frame: CGRect(x: 0, y: 0, width: 1000, height: 1000))
+		loadViewFromNib()
+		v = self
+		v.frame = bounds
+		v.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		v.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = v.bounds
+		v.addSubview(container)
+		
+		//Populate review array
+		preview = [photo0, photo1, photo2, photo3]
+		
+		// Set tap recognizer
+		let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (RowGallery.openAlbum (_:)))
+		tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+		self.addGestureRecognizer(tapRecognizer)
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	func openAlbum(_ sender:UITapGestureRecognizer? = nil){
+		NSLog(":ROW_GALLERY:DEBUG: Getting delegate and showing album \(self.id).")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showAlbum(id: self.id)
+	}
+	
+	/**
+	Changes the title of the album. Decodes HTML.
+	:param: text The new title.
+	*/
+	func setTitle(text: String){
+		title.text = "  \(text.stripHtml())"
+	}
+	
+	/**
+	Changes the preview image of the album.
+	If null or empty, the igage is hidden.
+	:param: path The new text.
+	*/
+	func setImage(idx: Int, filename: String){
+		if (filename == ""){
+			NSLog(":ROWGALLERY:DEBUG: No image for album \(self.id) at index \(idx).")
+			preview[idx].isHidden = true
+			//TODO hide the imageview
+		}
+		else{
+			NSLog(":ROWGALLERY:DEBUG: Set image \(filename) for album \(self.id) at index \(idx).")
+			let path = "img/galeria/thumb/\(filename)"
+			preview[idx].setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+		}
+	}
+	
+}

+ 152 - 0
app/RowGallery.xib

@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowGallery" customModule="app">
+            <connections>
+                <outlet property="container" destination="5s9-Le-qTP" id="Z8m-m7-LEO"/>
+                <outlet property="photo0" destination="ALA-B7-xYr" id="gBh-vt-C7l"/>
+                <outlet property="photo1" destination="1yK-KV-day" id="uHg-pA-CYk"/>
+                <outlet property="photo2" destination="FJP-ZD-LGA" id="7As-zB-f1E"/>
+                <outlet property="photo3" destination="Xwd-Zx-bfE" id="wvz-zu-nXM"/>
+                <outlet property="title" destination="0t2-77-n8R" id="JXv-hD-axV"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" userLabel="RowGallery" customClass="RowGallery" customModule="app">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5s9-Le-qTP" userLabel="Container">
+                    <rect key="frame" x="-0.5" y="183" width="375" height="300"/>
+                    <subviews>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hif-f7-Vxg" userLabel="Entry">
+                            <rect key="frame" x="10" y="10" width="355" height="280"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0t2-77-n8R">
+                                    <rect key="frame" x="0.0" y="10" width="355" height="21"/>
+                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+                                    <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="ALA-B7-xYr" userLabel="Photo0">
+                                    <rect key="frame" x="10" y="41" width="162.5" height="108"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="108" id="iiK-OG-AZy"/>
+                                    </constraints>
+                                    <userDefinedRuntimeAttributes>
+                                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                            <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        </userDefinedRuntimeAttribute>
+                                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                            <real key="value" value="1"/>
+                                        </userDefinedRuntimeAttribute>
+                                    </userDefinedRuntimeAttributes>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="1yK-KV-day" userLabel="Photo1">
+                                    <rect key="frame" x="182.5" y="41" width="162.5" height="108"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="108" id="vrH-X3-6Rl"/>
+                                    </constraints>
+                                    <userDefinedRuntimeAttributes>
+                                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                            <real key="value" value="1"/>
+                                        </userDefinedRuntimeAttribute>
+                                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                            <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        </userDefinedRuntimeAttribute>
+                                    </userDefinedRuntimeAttributes>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="FJP-ZD-LGA" userLabel="Photo2">
+                                    <rect key="frame" x="10" y="162" width="162.5" height="108"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="108" id="U9z-FX-Qxl"/>
+                                    </constraints>
+                                    <userDefinedRuntimeAttributes>
+                                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                            <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        </userDefinedRuntimeAttribute>
+                                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                            <real key="value" value="1"/>
+                                        </userDefinedRuntimeAttribute>
+                                    </userDefinedRuntimeAttributes>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="Xwd-Zx-bfE" userLabel="Photo3">
+                                    <rect key="frame" x="182.5" y="162" width="162.5" height="108"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="108" id="lL5-Te-XTy"/>
+                                    </constraints>
+                                    <userDefinedRuntimeAttributes>
+                                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                            <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        </userDefinedRuntimeAttribute>
+                                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                            <real key="value" value="1"/>
+                                        </userDefinedRuntimeAttribute>
+                                    </userDefinedRuntimeAttributes>
+                                </imageView>
+                            </subviews>
+                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                            <constraints>
+                                <constraint firstItem="ALA-B7-xYr" firstAttribute="top" secondItem="0t2-77-n8R" secondAttribute="bottom" constant="10" id="0t2-P2-3gu"/>
+                                <constraint firstItem="FJP-ZD-LGA" firstAttribute="leading" secondItem="hif-f7-Vxg" secondAttribute="leading" constant="10" id="5bO-l4-LGu"/>
+                                <constraint firstItem="1yK-KV-day" firstAttribute="trailing" secondItem="0t2-77-n8R" secondAttribute="trailing" constant="-10" id="DVh-LJ-p9e"/>
+                                <constraint firstItem="ALA-B7-xYr" firstAttribute="width" secondItem="hif-f7-Vxg" secondAttribute="width" multiplier="0.5" constant="-15" id="FKW-tk-kAd"/>
+                                <constraint firstItem="FJP-ZD-LGA" firstAttribute="width" secondItem="hif-f7-Vxg" secondAttribute="width" multiplier="0.5" constant="-15" id="G3l-Qc-THc"/>
+                                <constraint firstItem="ALA-B7-xYr" firstAttribute="leading" secondItem="0t2-77-n8R" secondAttribute="leading" constant="10" id="HoJ-in-dXf"/>
+                                <constraint firstItem="0t2-77-n8R" firstAttribute="centerX" secondItem="hif-f7-Vxg" secondAttribute="centerX" id="Paz-Pk-eSy"/>
+                                <constraint firstItem="Xwd-Zx-bfE" firstAttribute="width" secondItem="hif-f7-Vxg" secondAttribute="width" multiplier="0.5" constant="-15" id="QPQ-1R-oUR"/>
+                                <constraint firstItem="1yK-KV-day" firstAttribute="top" secondItem="0t2-77-n8R" secondAttribute="bottom" constant="10" id="Qxa-Ti-08x"/>
+                                <constraint firstItem="0t2-77-n8R" firstAttribute="top" secondItem="hif-f7-Vxg" secondAttribute="top" constant="10" id="WYO-vy-VPP"/>
+                                <constraint firstItem="FJP-ZD-LGA" firstAttribute="bottom" secondItem="hif-f7-Vxg" secondAttribute="bottom" constant="-10" id="amo-wJ-6JX"/>
+                                <constraint firstItem="0t2-77-n8R" firstAttribute="width" secondItem="hif-f7-Vxg" secondAttribute="width" id="bDV-Kx-fRp"/>
+                                <constraint firstItem="Xwd-Zx-bfE" firstAttribute="bottom" secondItem="hif-f7-Vxg" secondAttribute="bottom" constant="-10" id="hN9-fv-fa5"/>
+                                <constraint firstItem="1yK-KV-day" firstAttribute="width" secondItem="0t2-77-n8R" secondAttribute="width" multiplier="0.5" constant="-15" id="mnN-Gq-pa3"/>
+                                <constraint firstItem="Xwd-Zx-bfE" firstAttribute="trailing" secondItem="hif-f7-Vxg" secondAttribute="trailing" constant="-10" id="sfm-VE-DCx"/>
+                            </constraints>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" red="0.42745098039215684" green="0.41176470588235292" blue="0.56470588235294117" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <integer key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <integer key="value" value="3"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="300" id="7Yh-0e-ajC"/>
+                        <constraint firstAttribute="bottom" secondItem="hif-f7-Vxg" secondAttribute="bottom" constant="10" id="KJt-VS-2f3"/>
+                        <constraint firstItem="hif-f7-Vxg" firstAttribute="trailing" secondItem="5s9-Le-qTP" secondAttribute="trailing" constant="-10" id="dQW-pn-Jio"/>
+                        <constraint firstAttribute="top" secondItem="hif-f7-Vxg" secondAttribute="top" constant="-10" id="hXG-tn-58e"/>
+                        <constraint firstItem="hif-f7-Vxg" firstAttribute="leading" secondItem="5s9-Le-qTP" secondAttribute="leading" constant="10" id="noN-5r-cCi"/>
+                    </constraints>
+                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                </view>
+            </subviews>
+            <constraints>
+                <constraint firstItem="5s9-Le-qTP" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="58W-bA-0zy"/>
+                <constraint firstItem="5s9-Le-qTP" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="96p-IK-UFf"/>
+                <constraint firstItem="5s9-Le-qTP" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="aM7-gO-87G"/>
+            </constraints>
+        </view>
+    </objects>
+    <resources>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
+</document>

+ 120 - 0
app/RowHomeBlog.swift

@@ -0,0 +1,120 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowHomeBlog: UIView {
+	
+	//This view
+	var v: UIView!
+	
+	var id: Int!
+	
+	//The container.
+	@IBOutlet weak var container: UIView!
+	
+	//The entry
+	@IBOutlet weak var entry: UIView!
+	
+	//The post title.
+	@IBOutlet weak var title: UILabel!
+	
+	//The post text.
+	@IBOutlet weak var descrip: UILabel!
+	
+	//The image.
+	@IBOutlet weak var image: UIImageView!
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		v = self
+		v.frame = bounds
+		v.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		v.translatesAutoresizingMaskIntoConstraints = true
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = v.bounds
+		v.addSubview(container)
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	/**
+	Changes the title of the post. Decodes HTML.
+	:param: text The new title.
+	*/
+	func setTitle(text: String){
+		title.text = text.stripHtml()
+	}
+	
+	/**
+	Changes the text of the text. Decodes HTML.
+	:param: text The new text.
+	*/
+	func setText(text: String){
+		descrip.text = text.stripHtml()
+	}
+	
+	/**
+	Changes the image of the activity.
+	If null or empty, the igage is hidden.
+	:param: path The new text.
+	*/
+	func setImage(filename: String){
+		if (filename == ""){
+			print("No image")
+			//TODO hide the imageview
+		}
+		else{
+			print("Set image \(filename)")
+			let path = "img/blog/thumb/\(filename)"
+			image.setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+		}
+	}
+}

+ 111 - 0
app/RowHomeBlog.xib

@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16B2657" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<device id="retina4_7" orientation="portrait">
+<adaptation id="fullscreen"/>
+</device>
+<dependencies>
+<deployment identifier="iOS"/>
+<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+</dependencies>
+<objects>
+<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowHomeBlog" customModule="app">
+<connections>
+<outlet property="container" destination="2hI-rc-KPm" id="rWX-Vl-kOp"/>
+<outlet property="descrip" destination="f4E-5p-Bid" id="IF5-ck-qUL"/>
+<outlet property="entry" destination="wLM-VU-VYk" id="Gkq-yE-fdN"/>
+<outlet property="image" destination="WSe-uz-Uhz" id="iU4-jm-UzQ"/>
+<outlet property="title" destination="Bkz-DV-HVr" id="1ok-yI-Npt"/>
+</connections>
+</placeholder>
+<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+<view contentMode="scaleToFill" id="iN0-l3-epB" userLabel="RowHomePastActivities" customClass="RowHomePastActivities" customModule="app">
+<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+<subviews>
+<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2hI-rc-KPm" userLabel="Container">
+<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+<subviews>
+<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wLM-VU-VYk" userLabel="Entry">
+<rect key="frame" x="10" y="10" width="355" height="667"/>
+<subviews>
+<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bkz-DV-HVr" userLabel="Title">
+<rect key="frame" x="10" y="10" width="335" height="21.5"/>
+<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+<color key="textColor" red="0.15294117647058825" green="0.33333333333333331" blue="0.45098039215686275" alpha="1" colorSpace="calibratedRGB"/>
+<nil key="highlightedColor"/>
+</label>
+<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="WSe-uz-Uhz" userLabel="Image">
+<rect key="frame" x="10" y="40" width="89" height="64"/>
+<constraints>
+<constraint firstAttribute="height" constant="64" id="EJ3-uo-Xp3"/>
+</constraints>
+</imageView>
+<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f4E-5p-Bid" userLabel="Text">
+<rect key="frame" x="98" y="40" width="214" height="64"/>
+<fontDescription key="fontDescription" type="system" pointSize="17"/>
+<nil key="textColor"/>
+<nil key="highlightedColor"/>
+</label>
+</subviews>
+<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+<constraints>
+<constraint firstItem="WSe-uz-Uhz" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.2" id="9Lz-WQ-1aS"/>
+<constraint firstItem="f4E-5p-Bid" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="40" id="Emi-Ob-27Q"/>
+<constraint firstItem="Bkz-DV-HVr" firstAttribute="leading" secondItem="wLM-VU-VYk" secondAttribute="leading" constant="10" id="LSz-FM-x2V"/>
+<constraint firstItem="f4E-5p-Bid" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.7" id="MdM-ps-4b8"/>
+<constraint firstAttribute="trailing" secondItem="Bkz-DV-HVr" secondAttribute="trailing" constant="10" id="MdM-yF-pmK"/>
+<constraint firstItem="WSe-uz-Uhz" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="40" id="Pyf-oT-PQl"/>
+<constraint firstItem="WSe-uz-Uhz" firstAttribute="leading" secondItem="wLM-VU-VYk" secondAttribute="leading" constant="10" id="YG6-eX-oTj"/>
+<constraint firstItem="Bkz-DV-HVr" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="10" id="mwG-d2-HQL"/>
+<constraint firstAttribute="trailing" secondItem="f4E-5p-Bid" secondAttribute="trailing" constant="10" id="svU-xx-LsR"/>
+</constraints>
+<edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+<userDefinedRuntimeAttributes>
+<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+<color key="value" red="0.42745098039215684" green="0.41176470588235292" blue="0.56470588235294117" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+</userDefinedRuntimeAttribute>
+<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+<real key="value" value="1"/>
+</userDefinedRuntimeAttribute>
+<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+<real key="value" value="3"/>
+</userDefinedRuntimeAttribute>
+</userDefinedRuntimeAttributes>
+</view>
+</subviews>
+<constraints>
+<constraint firstItem="wLM-VU-VYk" firstAttribute="bottom" secondItem="2hI-rc-KPm" secondAttribute="bottom" constant="10" id="39K-W7-EIE"/>
+<constraint firstAttribute="trailing" secondItem="wLM-VU-VYk" secondAttribute="trailing" constant="10" id="HSF-55-R5c"/>
+<constraint firstAttribute="height" constant="120" id="PdT-5v-I0r"/>
+<constraint firstItem="wLM-VU-VYk" firstAttribute="top" secondItem="2hI-rc-KPm" secondAttribute="top" constant="10" id="fWN-oO-QzS"/>
+<constraint firstItem="wLM-VU-VYk" firstAttribute="leading" secondItem="2hI-rc-KPm" secondAttribute="leading" constant="10" id="teN-oh-Db9"/>
+</constraints>
+<edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+<userDefinedRuntimeAttributes>
+<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+<real key="value" value="0.0"/>
+</userDefinedRuntimeAttribute>
+</userDefinedRuntimeAttributes>
+</view>
+</subviews>
+<constraints>
+<constraint firstItem="2hI-rc-KPm" firstAttribute="height" secondItem="iN0-l3-epB" secondAttribute="height" id="Kwy-25-YES"/>
+<constraint firstItem="2hI-rc-KPm" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="clR-QU-zlD"/>
+<constraint firstItem="2hI-rc-KPm" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="htS-q0-otF"/>
+<constraint firstItem="2hI-rc-KPm" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="rig-k7-6bz"/>
+</constraints>
+<nil key="simulatedStatusBarMetrics"/>
+<userDefinedRuntimeAttributes>
+<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+<real key="value" value="0.0"/>
+</userDefinedRuntimeAttribute>
+</userDefinedRuntimeAttributes>
+<point key="canvasLocation" x="45.5" y="-43.5"/>
+</view>
+</objects>
+<resources>
+<image name="PhotoPlaceholder" width="170" height="108"/>
+</resources>
+</document>

+ 118 - 0
app/RowHomeFutureActivities.swift

@@ -0,0 +1,118 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowHomeFutureActivities: UIView {
+	
+	//This view
+	var v: UIView!
+	
+	//The container.
+	@IBOutlet weak var container: UIView!
+	
+	//The entry
+	@IBOutlet weak var entry: UIView!
+	
+	//The activity title.
+	@IBOutlet weak var title: UILabel!
+	
+	//The activity description.
+	@IBOutlet weak var descrip: UILabel!
+	
+	//The activity image.
+	@IBOutlet weak var image: UIImageView!
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		v = self
+		v.frame = bounds
+		v.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		v.translatesAutoresizingMaskIntoConstraints = true
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = v.bounds
+		v.addSubview(container)
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	/**
+	Changes the title of the activity. Decodes HTML.
+	:param: text The new title.
+	*/
+	func setTitle(text: String){
+		title.text = text.stripHtml()
+	}
+	
+	/**
+	Changes the description of the activity. Decodes HTML.
+	:param: text The new text.
+	*/
+	func setText(text: String){
+		descrip.text = text.stripHtml()
+	}
+	
+	/**
+	Changes the image of the activity.
+	If null or empty, the igage is hidden.
+	:param: path The new text.
+	*/
+	func setImage(filename: String){
+		if (filename == ""){
+			print("No image")
+			//TODO hide the imageview
+		}
+		else{
+			print("Set image \(filename)")
+			let path = "img/actividades/thumb/\(filename)"
+			image.setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+		}
+	}
+}

+ 111 - 0
app/RowHomeFutureActivities.xib

@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16B2657" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<device id="retina4_7" orientation="portrait">
+<adaptation id="fullscreen"/>
+</device>
+<dependencies>
+<deployment identifier="iOS"/>
+<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+</dependencies>
+<objects>
+<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowHomeFutureActivities" customModule="app">
+<connections>
+<outlet property="container" destination="2hI-rc-KPm" id="rWX-Vl-kOp"/>
+<outlet property="descrip" destination="f4E-5p-Bid" id="IF5-ck-qUL"/>
+<outlet property="entry" destination="wLM-VU-VYk" id="Gkq-yE-fdN"/>
+<outlet property="image" destination="WSe-uz-Uhz" id="iU4-jm-UzQ"/>
+<outlet property="title" destination="Bkz-DV-HVr" id="1ok-yI-Npt"/>
+</connections>
+</placeholder>
+<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+<view contentMode="scaleToFill" id="iN0-l3-epB" userLabel="RowHomePastActivities" customClass="RowHomePastActivities" customModule="app">
+<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+<subviews>
+<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2hI-rc-KPm" userLabel="Container">
+<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+<subviews>
+<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wLM-VU-VYk" userLabel="Entry">
+<rect key="frame" x="10" y="10" width="355" height="667"/>
+<subviews>
+<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bkz-DV-HVr" userLabel="Title">
+<rect key="frame" x="10" y="10" width="335" height="21.5"/>
+<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+<color key="textColor" red="0.15294117647058825" green="0.33333333333333331" blue="0.45098039215686275" alpha="1" colorSpace="calibratedRGB"/>
+<nil key="highlightedColor"/>
+</label>
+<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="WSe-uz-Uhz" userLabel="Image">
+<rect key="frame" x="10" y="40" width="89" height="64"/>
+<constraints>
+<constraint firstAttribute="height" constant="64" id="EJ3-uo-Xp3"/>
+</constraints>
+</imageView>
+<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f4E-5p-Bid" userLabel="Text">
+<rect key="frame" x="98" y="40" width="214" height="64"/>
+<fontDescription key="fontDescription" type="system" pointSize="17"/>
+<nil key="textColor"/>
+<nil key="highlightedColor"/>
+</label>
+</subviews>
+<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+<constraints>
+<constraint firstItem="WSe-uz-Uhz" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.2" id="9Lz-WQ-1aS"/>
+<constraint firstItem="f4E-5p-Bid" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="40" id="Emi-Ob-27Q"/>
+<constraint firstItem="Bkz-DV-HVr" firstAttribute="leading" secondItem="wLM-VU-VYk" secondAttribute="leading" constant="10" id="LSz-FM-x2V"/>
+<constraint firstItem="f4E-5p-Bid" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.7" id="MdM-ps-4b8"/>
+<constraint firstAttribute="trailing" secondItem="Bkz-DV-HVr" secondAttribute="trailing" constant="10" id="MdM-yF-pmK"/>
+<constraint firstItem="WSe-uz-Uhz" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="40" id="Pyf-oT-PQl"/>
+<constraint firstItem="WSe-uz-Uhz" firstAttribute="leading" secondItem="wLM-VU-VYk" secondAttribute="leading" constant="10" id="YG6-eX-oTj"/>
+<constraint firstItem="Bkz-DV-HVr" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="10" id="mwG-d2-HQL"/>
+<constraint firstAttribute="trailing" secondItem="f4E-5p-Bid" secondAttribute="trailing" constant="10" id="svU-xx-LsR"/>
+</constraints>
+<edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+<userDefinedRuntimeAttributes>
+<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+<color key="value" red="0.42745098039215684" green="0.41176470588235292" blue="0.56470588235294117" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+</userDefinedRuntimeAttribute>
+<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+<real key="value" value="1"/>
+</userDefinedRuntimeAttribute>
+<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+<real key="value" value="3"/>
+</userDefinedRuntimeAttribute>
+</userDefinedRuntimeAttributes>
+</view>
+</subviews>
+<constraints>
+<constraint firstItem="wLM-VU-VYk" firstAttribute="bottom" secondItem="2hI-rc-KPm" secondAttribute="bottom" constant="10" id="39K-W7-EIE"/>
+<constraint firstAttribute="trailing" secondItem="wLM-VU-VYk" secondAttribute="trailing" constant="10" id="HSF-55-R5c"/>
+<constraint firstAttribute="height" constant="120" id="PdT-5v-I0r"/>
+<constraint firstItem="wLM-VU-VYk" firstAttribute="top" secondItem="2hI-rc-KPm" secondAttribute="top" constant="10" id="fWN-oO-QzS"/>
+<constraint firstItem="wLM-VU-VYk" firstAttribute="leading" secondItem="2hI-rc-KPm" secondAttribute="leading" constant="10" id="teN-oh-Db9"/>
+</constraints>
+<edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+<userDefinedRuntimeAttributes>
+<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+<real key="value" value="0.0"/>
+</userDefinedRuntimeAttribute>
+</userDefinedRuntimeAttributes>
+</view>
+</subviews>
+<constraints>
+<constraint firstItem="2hI-rc-KPm" firstAttribute="height" secondItem="iN0-l3-epB" secondAttribute="height" id="Kwy-25-YES"/>
+<constraint firstItem="2hI-rc-KPm" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="clR-QU-zlD"/>
+<constraint firstItem="2hI-rc-KPm" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="htS-q0-otF"/>
+<constraint firstItem="2hI-rc-KPm" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="rig-k7-6bz"/>
+</constraints>
+<nil key="simulatedStatusBarMetrics"/>
+<userDefinedRuntimeAttributes>
+<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+<real key="value" value="0.0"/>
+</userDefinedRuntimeAttribute>
+</userDefinedRuntimeAttributes>
+<point key="canvasLocation" x="45.5" y="-43.5"/>
+</view>
+</objects>
+<resources>
+<image name="PhotoPlaceholder" width="170" height="108"/>
+</resources>
+</document>

+ 102 - 0
app/RowHomeGallery.swift

@@ -0,0 +1,102 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowHomeGallery: UIView {
+	
+	//This view
+	var v: UIView!
+	
+	@IBOutlet weak var container: UIView!
+	@IBOutlet weak var photo0: UIImageView!
+	@IBOutlet weak var photo1: UIImageView!
+	@IBOutlet weak var photo2: UIImageView!
+	@IBOutlet weak var photo3: UIImageView!
+	
+	var photos: [UIImageView] = []
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		v = self
+		//v.frame = bounds
+		//v.bounds = v.frame
+		//v.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		//v.translatesAutoresizingMaskIntoConstraints = true
+		//container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		//container.translatesAutoresizingMaskIntoConstraints = true
+		
+		//container.frame = v.bounds
+		v.addSubview(container)
+		
+		photos = [photo0, photo1, photo2, photo3]
+		
+
+		
+		//TODO Set click listeners
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	/**
+	Changes the preview image.
+	If null or empty, the igage is hidden.
+	:param: path The new text.
+	*/
+	func setImage(idx: Int, filename: String){
+		if (filename == ""){
+			print("ROWHOMEGALLERY:LOG: No image.")
+			//TODO hide the imageview
+		}
+		else{
+			let path = "img/galeria/thumb/\(filename)"
+			photos[idx].setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+		}
+	}
+	
+}

+ 112 - 0
app/RowHomeGallery.xib

@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowHomeGallery" customModule="app">
+            <connections>
+                <outlet property="container" destination="fQL-ej-f6f" id="gat-5m-Nlc"/>
+                <outlet property="photo0" destination="dnB-DT-XBi" id="Gcn-A3-qVV"/>
+                <outlet property="photo1" destination="WDB-y4-09J" id="yCC-HU-nfj"/>
+                <outlet property="photo2" destination="anB-pq-Srl" id="VWm-9P-5aK"/>
+                <outlet property="photo3" destination="fDa-I0-n0C" id="oyE-AI-yhP"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="RowHomeGallery" customModule="app">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fQL-ej-f6f" userLabel="Container">
+                    <rect key="frame" x="-0.5" y="0.0" width="375" height="230"/>
+                    <subviews>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wVc-lu-Pqh" userLabel="Entry">
+                            <rect key="frame" x="10" y="10" width="355" height="230"/>
+                            <subviews>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="dnB-DT-XBi" userLabel="Photo0">
+                                    <rect key="frame" x="10" y="10" width="162.5" height="100"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="100" id="c49-em-SBK"/>
+                                    </constraints>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="WDB-y4-09J" userLabel="Photo1">
+                                    <rect key="frame" x="182.5" y="10" width="162.5" height="100"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="100" id="PMB-24-syn"/>
+                                    </constraints>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="anB-pq-Srl" userLabel="Photo2">
+                                    <rect key="frame" x="10" y="120" width="162.5" height="100"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="100" id="A9o-VC-FHH"/>
+                                    </constraints>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="fDa-I0-n0C" userLabel="Photo3">
+                                    <rect key="frame" x="182.5" y="120" width="162.5" height="100"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="100" id="Lw8-Ie-YJH"/>
+                                    </constraints>
+                                </imageView>
+                            </subviews>
+                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                            <constraints>
+                                <constraint firstItem="dnB-DT-XBi" firstAttribute="width" secondItem="wVc-lu-Pqh" secondAttribute="width" multiplier="0.5" constant="-15" id="68Z-py-m5z"/>
+                                <constraint firstItem="anB-pq-Srl" firstAttribute="top" secondItem="dnB-DT-XBi" secondAttribute="bottom" constant="10" id="Bad-nG-5z5"/>
+                                <constraint firstItem="dnB-DT-XBi" firstAttribute="leading" secondItem="wVc-lu-Pqh" secondAttribute="leading" constant="10" id="D5O-yf-YW8"/>
+                                <constraint firstItem="fDa-I0-n0C" firstAttribute="top" secondItem="WDB-y4-09J" secondAttribute="bottom" constant="10" id="EAz-Ai-4fI"/>
+                                <constraint firstItem="anB-pq-Srl" firstAttribute="leading" secondItem="wVc-lu-Pqh" secondAttribute="leading" constant="10" id="EBa-JH-t1r"/>
+                                <constraint firstItem="anB-pq-Srl" firstAttribute="width" secondItem="wVc-lu-Pqh" secondAttribute="width" multiplier="0.5" constant="-15" id="EcJ-3D-reB"/>
+                                <constraint firstAttribute="height" constant="230" id="Ffn-YP-qLO"/>
+                                <constraint firstItem="WDB-y4-09J" firstAttribute="top" secondItem="wVc-lu-Pqh" secondAttribute="top" constant="10" id="NRB-ED-7lT"/>
+                                <constraint firstItem="fDa-I0-n0C" firstAttribute="width" secondItem="wVc-lu-Pqh" secondAttribute="width" multiplier="0.5" constant="-15" id="gYW-t2-gNJ"/>
+                                <constraint firstItem="WDB-y4-09J" firstAttribute="trailing" secondItem="wVc-lu-Pqh" secondAttribute="trailing" constant="-10" id="lWA-u1-9Oi"/>
+                                <constraint firstItem="dnB-DT-XBi" firstAttribute="top" secondItem="wVc-lu-Pqh" secondAttribute="top" constant="10" id="mWE-kd-0X9"/>
+                                <constraint firstItem="fDa-I0-n0C" firstAttribute="trailing" secondItem="wVc-lu-Pqh" secondAttribute="trailing" constant="-10" id="tJB-Qz-gmc"/>
+                                <constraint firstItem="WDB-y4-09J" firstAttribute="width" secondItem="wVc-lu-Pqh" secondAttribute="width" multiplier="0.5" constant="-15" id="tJI-ji-ciu"/>
+                            </constraints>
+                            <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" red="0.42745098039215684" green="0.41176470588235292" blue="0.56470588235294117" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <integer key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <integer key="value" value="3"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="wVc-lu-Pqh" firstAttribute="bottom" secondItem="fQL-ej-f6f" secondAttribute="bottom" constant="10" id="4Qm-4E-T6T"/>
+                        <constraint firstAttribute="trailing" secondItem="wVc-lu-Pqh" secondAttribute="trailing" constant="10" id="Gw9-3i-bdM"/>
+                        <constraint firstItem="wVc-lu-Pqh" firstAttribute="top" secondItem="fQL-ej-f6f" secondAttribute="top" constant="10" id="JpE-6m-QpJ"/>
+                        <constraint firstItem="wVc-lu-Pqh" firstAttribute="leading" secondItem="fQL-ej-f6f" secondAttribute="leading" constant="10" id="sx2-Al-2U2"/>
+                    </constraints>
+                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                </view>
+            </subviews>
+            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <constraints>
+                <constraint firstItem="fQL-ej-f6f" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="D1e-8E-fga"/>
+                <constraint firstItem="fQL-ej-f6f" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="Pfz-ns-fxp"/>
+                <constraint firstItem="fQL-ej-f6f" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="r6U-3K-HqE"/>
+            </constraints>
+        </view>
+    </objects>
+    <resources>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
+</document>

+ 151 - 0
app/RowHomeSocial.swift

@@ -0,0 +1,151 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowHomeSocial: UIView {
+	
+	//This view
+	var v: UIView!
+	
+	//The container.
+	@IBOutlet weak var container: UIView!
+	
+	//The container.
+	@IBOutlet weak var entry: UIView!
+	
+	//The buttons
+	@IBOutlet weak var btnPhone: UIImageView!
+	@IBOutlet weak var btnMail: UIImageView!
+	@IBOutlet weak var btnWhatsapp: UIImageView!
+	@IBOutlet weak var btnFacebook: UIImageView!
+	@IBOutlet weak var btnTwitter: UIImageView!
+	@IBOutlet weak var btnGoogle: UIImageView!
+	@IBOutlet weak var btnYoutube: UIImageView!
+	@IBOutlet weak var btnInstagram: UIImageView!
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	private func loadViewFromNib() {
+		print("LOADING NIB...")
+		let bundle = Bundle(for: type(of: self))
+		print("GOT BUNDLE...")
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		print("NIB CREATED")
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+		print("NIB INSTANTIATED")
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		v = self
+		v.frame = bounds
+		v.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		v.translatesAutoresizingMaskIntoConstraints = true
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = v.bounds
+		v.addSubview(container)
+		
+		// Set buttons up
+		let phoneTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(didTapPhone))
+		btnPhone.isUserInteractionEnabled = true
+		btnPhone.addGestureRecognizer(phoneTapRecognizer)
+		let mailTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(didTapMail))
+		btnMail.isUserInteractionEnabled = true
+		btnMail.addGestureRecognizer(mailTapRecognizer)
+		let whatsappTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(didTapWhatsapp))
+		btnWhatsapp.isUserInteractionEnabled = true
+		btnWhatsapp.addGestureRecognizer(whatsappTapRecognizer)
+		let facebookTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(didTapFacebook))
+		btnFacebook.isUserInteractionEnabled = true
+		btnFacebook.addGestureRecognizer(facebookTapRecognizer)
+		let twitterTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(didTapTwitter))
+		btnTwitter.isUserInteractionEnabled = true
+		btnTwitter.addGestureRecognizer(twitterTapRecognizer)
+		let googleTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(didTapGoogle))
+		btnGoogle.isUserInteractionEnabled = true
+		btnGoogle.addGestureRecognizer(googleTapRecognizer)
+		let youtubeTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(didTapYoutube))
+		btnYoutube.isUserInteractionEnabled = true
+		btnYoutube.addGestureRecognizer(youtubeTapRecognizer)
+		let instagramTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(didTapInstagram))
+		btnInstagram.isUserInteractionEnabled = true
+		btnInstagram.addGestureRecognizer(instagramTapRecognizer)
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	func didTapPhone() {
+		UIApplication.shared.openURL(NSURL(string: "tel://+34637140371") as! URL)
+	}
+	
+	func didTapMail() {
+		UIApplication.shared.openURL(NSURL(string: "mailto:gasteizkomargolariak@gmail.com") as! URL)
+	}
+	
+	func didTapWhatsapp() {
+		//As of today, imposible
+		//UIApplication.shared.openURL(NSURL(string: "+34637140371") as! URL)
+	}
+	
+	func didTapFacebook() {
+		UIApplication.shared.openURL(NSURL(string: "http://facebook.com/gmargolariak") as! URL)
+	}
+	
+	func didTapTwitter() {
+		UIApplication.shared.openURL(NSURL(string: "http://twitter.com/gmargolariak") as! URL)
+	}
+	
+	func didTapGoogle() {
+		UIApplication.shared.openURL(NSURL(string: "https://plus.google.com/106661466029005469492") as! URL)
+	}
+	
+	func didTapYoutube() {
+		UIApplication.shared.openURL(NSURL(string: "https://www.youtube.com/user/GasteizkoMargolariak") as! URL)
+	}
+	
+	func didTapInstagram() {
+		UIApplication.shared.openURL(NSURL(string: "https://instagram.com/gmargolariak/") as! URL)
+	}
+	
+	
+}

+ 155 - 0
app/RowHomeSocial.xib

@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16B2657" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowHomeSocial" customModule="app">
+            <connections>
+                <outlet property="btnFacebook" destination="wP8-1o-Rrh" id="6uv-pC-Nta"/>
+                <outlet property="btnGoogle" destination="L4k-eK-pkc" id="DCM-a0-yah"/>
+                <outlet property="btnInstagram" destination="OlS-ga-Ngl" id="egF-6B-SQd"/>
+                <outlet property="btnMail" destination="5Xa-Sh-XrB" id="HCb-xY-VDs"/>
+                <outlet property="btnPhone" destination="512-B2-6nt" id="C2I-qn-kPa"/>
+                <outlet property="btnTwitter" destination="Ttk-Ce-1XP" id="JUs-rm-Q5M"/>
+                <outlet property="btnWhatsapp" destination="0jq-K4-utG" id="d7P-Md-D7b"/>
+                <outlet property="btnYoutube" destination="1qd-jG-4Bn" id="WVU-fK-qg1"/>
+                <outlet property="container" destination="2hI-rc-KPm" id="Qyi-RK-3V8"/>
+                <outlet property="entry" destination="wLM-VU-VYk" id="ebu-Wm-4By"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" userLabel="RowHomeSocial" customClass="RowHomeSocial" customModule="app">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2hI-rc-KPm" userLabel="Container">
+                    <rect key="frame" x="0.0" y="0.0" width="375" height="177.5"/>
+                    <subviews>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wLM-VU-VYk" userLabel="Entry">
+                            <rect key="frame" x="10" y="10" width="355" height="177.5"/>
+                            <subviews>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" image="Phone" translatesAutoresizingMaskIntoConstraints="NO" id="512-B2-6nt">
+                                    <rect key="frame" x="0.0" y="0.0" width="89.5" height="89.5"/>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" image="Mail" translatesAutoresizingMaskIntoConstraints="NO" id="5Xa-Sh-XrB" userLabel="Mail">
+                                    <rect key="frame" x="89.5" y="0.0" width="89" height="89.5"/>
+                                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" image="Whatsapp" translatesAutoresizingMaskIntoConstraints="NO" id="0jq-K4-utG" userLabel="Whatsapp">
+                                    <rect key="frame" x="179" y="0.0" width="89" height="89"/>
+                                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" image="Facebook" translatesAutoresizingMaskIntoConstraints="NO" id="wP8-1o-Rrh" userLabel="Facebook">
+                                    <rect key="frame" x="268" y="0.0" width="89" height="89"/>
+                                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" image="Twitter" translatesAutoresizingMaskIntoConstraints="NO" id="Ttk-Ce-1XP">
+                                    <rect key="frame" x="0.0" y="90" width="89.5" height="89.5"/>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" image="GooglePlus" translatesAutoresizingMaskIntoConstraints="NO" id="L4k-eK-pkc">
+                                    <rect key="frame" x="90" y="90" width="89.5" height="89.5"/>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" image="Youtube" translatesAutoresizingMaskIntoConstraints="NO" id="1qd-jG-4Bn">
+                                    <rect key="frame" x="179" y="89" width="89.5" height="89.5"/>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" image="Instagram" translatesAutoresizingMaskIntoConstraints="NO" id="OlS-ga-Ngl">
+                                    <rect key="frame" x="268" y="89" width="89.5" height="89.5"/>
+                                </imageView>
+                            </subviews>
+                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                            <constraints>
+                                <constraint firstItem="Ttk-Ce-1XP" firstAttribute="width" secondItem="512-B2-6nt" secondAttribute="width" id="0QX-sh-Y62"/>
+                                <constraint firstItem="Ttk-Ce-1XP" firstAttribute="height" secondItem="512-B2-6nt" secondAttribute="height" id="39L-QV-csw"/>
+                                <constraint firstItem="wP8-1o-Rrh" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" id="3xb-00-2P6"/>
+                                <constraint firstItem="5Xa-Sh-XrB" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.25" id="7T1-Hk-R35"/>
+                                <constraint firstItem="Ttk-Ce-1XP" firstAttribute="top" secondItem="512-B2-6nt" secondAttribute="bottom" id="9F0-DU-FFO"/>
+                                <constraint firstItem="0jq-K4-utG" firstAttribute="leading" secondItem="5Xa-Sh-XrB" secondAttribute="trailing" id="AH1-0L-nYQ"/>
+                                <constraint firstItem="1qd-jG-4Bn" firstAttribute="height" secondItem="0jq-K4-utG" secondAttribute="height" id="CUC-LH-oVM"/>
+                                <constraint firstItem="wP8-1o-Rrh" firstAttribute="leading" secondItem="0jq-K4-utG" secondAttribute="trailing" id="IM6-dv-FSu"/>
+                                <constraint firstItem="L4k-eK-pkc" firstAttribute="height" secondItem="5Xa-Sh-XrB" secondAttribute="height" id="IWg-0Z-7tO"/>
+                                <constraint firstItem="L4k-eK-pkc" firstAttribute="top" secondItem="5Xa-Sh-XrB" secondAttribute="bottom" id="Jf9-UI-kn3"/>
+                                <constraint firstItem="L4k-eK-pkc" firstAttribute="leading" secondItem="5Xa-Sh-XrB" secondAttribute="leading" id="Lkg-Ff-jNA"/>
+                                <constraint firstItem="wP8-1o-Rrh" firstAttribute="height" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.25" id="Lyv-es-d3j"/>
+                                <constraint firstItem="512-B2-6nt" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.25" id="MYA-FO-b5k"/>
+                                <constraint firstItem="1qd-jG-4Bn" firstAttribute="top" secondItem="0jq-K4-utG" secondAttribute="bottom" id="QMP-Gi-WCw"/>
+                                <constraint firstItem="0jq-K4-utG" firstAttribute="height" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.25" id="RPd-iR-02y"/>
+                                <constraint firstItem="512-B2-6nt" firstAttribute="height" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.25" id="Z1m-CY-xaF"/>
+                                <constraint firstItem="5Xa-Sh-XrB" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" id="aFU-bQ-Y2T"/>
+                                <constraint firstItem="OlS-ga-Ngl" firstAttribute="leading" secondItem="wP8-1o-Rrh" secondAttribute="leading" id="aGq-AJ-HXg"/>
+                                <constraint firstItem="5Xa-Sh-XrB" firstAttribute="height" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.25" id="agd-tD-Z7B"/>
+                                <constraint firstItem="L4k-eK-pkc" firstAttribute="width" secondItem="5Xa-Sh-XrB" secondAttribute="width" id="bD5-gc-RZQ"/>
+                                <constraint firstItem="OlS-ga-Ngl" firstAttribute="width" secondItem="wP8-1o-Rrh" secondAttribute="width" id="bil-4K-d7f"/>
+                                <constraint firstItem="Ttk-Ce-1XP" firstAttribute="leading" secondItem="512-B2-6nt" secondAttribute="leading" id="fMj-Zv-80b"/>
+                                <constraint firstItem="wP8-1o-Rrh" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.25" id="gjG-xf-f2v"/>
+                                <constraint firstItem="5Xa-Sh-XrB" firstAttribute="leading" secondItem="512-B2-6nt" secondAttribute="trailing" id="iay-5b-e6B"/>
+                                <constraint firstItem="1qd-jG-4Bn" firstAttribute="width" secondItem="0jq-K4-utG" secondAttribute="width" id="jDu-hC-arJ"/>
+                                <constraint firstAttribute="height" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.5" id="jGP-1G-1P3"/>
+                                <constraint firstItem="512-B2-6nt" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" id="lyN-c0-DOH"/>
+                                <constraint firstItem="0jq-K4-utG" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" id="nUV-gk-zhw"/>
+                                <constraint firstItem="0jq-K4-utG" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.25" id="uCp-Vv-c61"/>
+                                <constraint firstItem="OlS-ga-Ngl" firstAttribute="top" secondItem="wP8-1o-Rrh" secondAttribute="bottom" id="vCU-hL-wuO"/>
+                                <constraint firstItem="512-B2-6nt" firstAttribute="leading" secondItem="wLM-VU-VYk" secondAttribute="leading" id="wMJ-K2-1e9"/>
+                                <constraint firstItem="OlS-ga-Ngl" firstAttribute="height" secondItem="wP8-1o-Rrh" secondAttribute="height" id="xZ5-XM-Ixz"/>
+                                <constraint firstItem="1qd-jG-4Bn" firstAttribute="leading" secondItem="0jq-K4-utG" secondAttribute="leading" id="zfP-9S-Gfc"/>
+                            </constraints>
+                            <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" red="0.42745098039215684" green="0.41176470588235292" blue="0.56470588235294117" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <real key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <real key="value" value="3"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="wLM-VU-VYk" firstAttribute="bottom" secondItem="2hI-rc-KPm" secondAttribute="bottom" constant="10" id="39K-W7-EIE"/>
+                        <constraint firstAttribute="trailing" secondItem="wLM-VU-VYk" secondAttribute="trailing" constant="10" id="HSF-55-R5c"/>
+                        <constraint firstItem="wLM-VU-VYk" firstAttribute="top" secondItem="2hI-rc-KPm" secondAttribute="top" constant="10" id="fWN-oO-QzS"/>
+                        <constraint firstItem="wLM-VU-VYk" firstAttribute="leading" secondItem="2hI-rc-KPm" secondAttribute="leading" constant="10" id="teN-oh-Db9"/>
+                    </constraints>
+                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                            <real key="value" value="0.0"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
+                </view>
+            </subviews>
+            <constraints>
+                <constraint firstItem="2hI-rc-KPm" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="cYi-xQ-QXA"/>
+                <constraint firstItem="2hI-rc-KPm" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="clR-QU-zlD"/>
+                <constraint firstItem="2hI-rc-KPm" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="rig-k7-6bz"/>
+            </constraints>
+            <nil key="simulatedStatusBarMetrics"/>
+            <userDefinedRuntimeAttributes>
+                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                    <real key="value" value="0.0"/>
+                </userDefinedRuntimeAttribute>
+            </userDefinedRuntimeAttributes>
+            <point key="canvasLocation" x="-36.5" y="-43.5"/>
+        </view>
+    </objects>
+    <resources>
+        <image name="Facebook" width="105" height="105"/>
+        <image name="GooglePlus" width="105" height="105"/>
+        <image name="Instagram" width="105" height="105"/>
+        <image name="Mail" width="105" height="105"/>
+        <image name="Phone" width="105" height="105"/>
+        <image name="Twitter" width="105" height="105"/>
+        <image name="Whatsapp" width="105" height="105"/>
+        <image name="Youtube" width="105" height="105"/>
+    </resources>
+</document>

+ 89 - 0
app/RowLablancaDay.swift

@@ -0,0 +1,89 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowLablancaDay: UIView {
+	
+	// Outlets
+	@IBOutlet weak var container: UIView!
+	@IBOutlet weak var number: UILabel!
+	@IBOutlet weak var month: UILabel!
+	@IBOutlet weak var name: UILabel!
+	@IBOutlet weak var price: UILabel!
+	@IBOutlet weak var separator: UIView!
+	
+	
+	
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	/**
+	Loads the view from the xib with the same name as the class.
+	*/
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+		
+		self.frame = self.bounds
+		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		self.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = self.bounds
+		self.addSubview(container)
+		
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		NSLog(":ROWLABLANCADAY:DEBUG: Init \(s), \(i)")
+		
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		self.frame = self.bounds
+		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		self.translatesAutoresizingMaskIntoConstraints = true
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+}

+ 102 - 0
app/RowLablancaDay.xib

@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina3_5" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowLablancaDay" customModule="app">
+            <connections>
+                <outlet property="container" destination="gfH-i8-jRE" id="wgl-1w-I1S"/>
+                <outlet property="month" destination="5Qr-iE-jB1" id="N9E-Yg-Dx5"/>
+                <outlet property="name" destination="Bq6-IK-wMo" id="f8D-Fk-GR1"/>
+                <outlet property="number" destination="fyr-yz-Mdw" id="tbR-wz-NFB"/>
+                <outlet property="price" destination="EBl-yy-csC" id="iW2-CE-0GB"/>
+                <outlet property="separator" destination="jGw-ai-rD9" id="qZ8-a1-fSi"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="RowLablancaDay" customModule="app">
+            <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gfH-i8-jRE" userLabel="Container">
+                    <rect key="frame" x="0.0" y="197.5" width="320" height="85"/>
+                    <subviews>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="25" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fyr-yz-Mdw" userLabel="Number">
+                            <rect key="frame" x="0.0" y="0.0" width="60" height="50"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="50" id="B8H-ex-mmQ"/>
+                                <constraint firstAttribute="width" constant="60" id="VZe-Ub-0PF"/>
+                            </constraints>
+                            <fontDescription key="fontDescription" type="boldSystem" pointSize="30"/>
+                            <nil key="textColor"/>
+                            <nil key="highlightedColor"/>
+                        </label>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Agosto" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5Qr-iE-jB1" userLabel="Month">
+                            <rect key="frame" x="0.0" y="50" width="80" height="20.5"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="80" id="RZL-5X-uNW"/>
+                            </constraints>
+                            <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
+                            <nil key="textColor"/>
+                            <nil key="highlightedColor"/>
+                        </label>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Margo Txiki" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bq6-IK-wMo" userLabel="Name">
+                            <rect key="frame" x="80" y="0.0" width="160" height="60"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="60" id="INd-c0-4oI"/>
+                            </constraints>
+                            <fontDescription key="fontDescription" type="italicSystem" pointSize="17"/>
+                            <color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                            <nil key="highlightedColor"/>
+                        </label>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="60 E" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EBl-yy-csC" userLabel="Price">
+                            <rect key="frame" x="240" y="0.0" width="70" height="85"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="70" id="E4j-HZ-ldc"/>
+                            </constraints>
+                            <fontDescription key="fontDescription" type="boldSystem" pointSize="30"/>
+                            <color key="textColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                            <nil key="highlightedColor"/>
+                        </label>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jGw-ai-rD9" userLabel="BSeparator">
+                            <rect key="frame" x="16" y="79" width="288" height="1"/>
+                            <color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="1" id="J4D-Ti-cxq"/>
+                            </constraints>
+                        </view>
+                    </subviews>
+                    <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                    <constraints>
+                        <constraint firstItem="EBl-yy-csC" firstAttribute="height" secondItem="gfH-i8-jRE" secondAttribute="height" id="0Y2-3c-XrT"/>
+                        <constraint firstItem="fyr-yz-Mdw" firstAttribute="leading" secondItem="gfH-i8-jRE" secondAttribute="leading" id="35s-RT-Oj6"/>
+                        <constraint firstItem="Bq6-IK-wMo" firstAttribute="top" secondItem="gfH-i8-jRE" secondAttribute="top" id="8jB-bt-jc1"/>
+                        <constraint firstAttribute="trailing" secondItem="Bq6-IK-wMo" secondAttribute="trailing" constant="80" id="EQ4-Hb-Tak"/>
+                        <constraint firstItem="fyr-yz-Mdw" firstAttribute="top" secondItem="gfH-i8-jRE" secondAttribute="top" id="J4i-zA-a0P"/>
+                        <constraint firstItem="5Qr-iE-jB1" firstAttribute="leading" secondItem="gfH-i8-jRE" secondAttribute="leading" id="NIm-B3-jCe"/>
+                        <constraint firstItem="jGw-ai-rD9" firstAttribute="width" secondItem="gfH-i8-jRE" secondAttribute="width" multiplier="0.9" id="PFQ-Ss-B4n"/>
+                        <constraint firstItem="5Qr-iE-jB1" firstAttribute="top" secondItem="fyr-yz-Mdw" secondAttribute="bottom" id="SK6-qC-aSb"/>
+                        <constraint firstItem="jGw-ai-rD9" firstAttribute="centerX" secondItem="gfH-i8-jRE" secondAttribute="centerX" id="cXu-Ex-OPq"/>
+                        <constraint firstAttribute="bottom" secondItem="EBl-yy-csC" secondAttribute="bottom" id="eKu-rV-ta5"/>
+                        <constraint firstAttribute="bottom" secondItem="jGw-ai-rD9" secondAttribute="bottom" constant="5" id="iXz-7T-gxt"/>
+                        <constraint firstItem="Bq6-IK-wMo" firstAttribute="leading" secondItem="fyr-yz-Mdw" secondAttribute="trailing" constant="20" id="p56-bu-QTp"/>
+                        <constraint firstAttribute="height" constant="85" id="r9E-HA-2EY"/>
+                        <constraint firstAttribute="trailing" secondItem="EBl-yy-csC" secondAttribute="trailing" constant="10" id="r9k-aS-TeZ"/>
+                    </constraints>
+                </view>
+            </subviews>
+            <constraints>
+                <constraint firstItem="gfH-i8-jRE" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="YtF-gj-uYr"/>
+                <constraint firstItem="gfH-i8-jRE" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="mOr-Je-9MW"/>
+                <constraint firstItem="gfH-i8-jRE" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="ocq-OY-EmP"/>
+            </constraints>
+        </view>
+    </objects>
+</document>

+ 42 - 0
app/UIApplcation.swift

@@ -0,0 +1,42 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIApplication to get the root view controller.
+*/
+extension UIApplication {
+	class func topViewController(controller: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -> UIViewController? {
+		if let navigationController = controller as? UINavigationController {
+			return topViewController(controller: navigationController.visibleViewController)
+		}
+		if let tabController = controller as? UITabBarController {
+			if let selected = tabController.selectedViewController {
+				return topViewController(controller: selected)
+			}
+		}
+		if let presented = controller?.presentedViewController {
+			return topViewController(controller: presented)
+		}
+		return controller
+	}
+}

+ 66 - 6
app/UIImageView.swift

@@ -40,14 +40,74 @@ extension UIImageView {
 		let filePath = url.appendingPathComponent(localPath)?.path
 		let fileManager = FileManager.default
 		if fileManager.fileExists(atPath: filePath!) {
-			print("FILE AVAILABLE: \(filePath)")
-			//TODO Set image
+			print("IMAGE:LOG: File available: \(filePath)")
+			
+			//Set image
+			do{
+				//let iurl = URL(string: filePath!)
+				let idata = try Data(contentsOf: URL(fileURLWithPath: filePath!))
+				self.image = UIImage(data: idata as Data)
+			}
+			catch (let error){
+				print("IMAGE:ERROR: Error setting image: \(error.localizedDescription)")
+				return -1
+			}
 			return 0
 		} else {
-			print("FILE NOT AVAILABLE: \(filePath)")
-			print("Downloading from \(remotePath)")
-			//TODO Download
-			//TODO Set image
+			print("IMAGE:LOG: File not available: \(filePath)")
+			print("IMAGE:LOG: Downloading from \(remotePath)")
+			
+			//Create required directories
+			var fileFolderUrl = URL(fileURLWithPath: filePath!)
+			fileFolderUrl.deleteLastPathComponent()
+			do{
+				try fileManager.createDirectory(at:  fileFolderUrl, withIntermediateDirectories: true, attributes: nil)
+			}
+			catch(let error){
+				print("IMAGE:ERROR: Error creating directories at \(fileFolderUrl.path): \(error.localizedDescription)")
+			}
+			
+			// Create destination URL
+			let destinationFileUrl = URL(fileURLWithPath: filePath!)
+			
+			//Create URL to the source file you want to download
+			let fileURL = URL(string: remotePath)
+			
+			let sessionConfig = URLSessionConfiguration.default
+			let session = URLSession(configuration: sessionConfig)
+			
+			let request = URLRequest(url:fileURL!)
+			
+			let task = session.downloadTask(with: request) { (tempLocalUrl, response, error) in
+				if let tempLocalUrl = tempLocalUrl, error == nil {
+					
+					// Success
+					if let statusCode = (response as? HTTPURLResponse)?.statusCode {
+						print("IMAGE:LOG: Successfully downloaded. Status code: \(statusCode)")
+					}
+					
+					do {
+						try FileManager.default.copyItem(at: tempLocalUrl, to: destinationFileUrl)
+					} catch (let writeError) {
+						print("IMAGE:ERROR: Error creating a file \(destinationFileUrl) : \(writeError)")
+					}
+					
+					// Set the image
+					do{
+						let idata = try Data(contentsOf: URL(fileURLWithPath: filePath!))
+						self.image = UIImage(data: idata as Data)
+					}
+					catch (let error){
+						print("IMAGE:ERROR: Error setting image: \(error.localizedDescription)")
+					}
+					
+				} else {
+					print("IMAGE:ERROR: Error took place while downloading a file: %@", error?.localizedDescription);
+				}
+			}
+			task.resume()
+		
+		
 			return 1
 		}
 

+ 16 - 0
app/UIView.swift

@@ -59,4 +59,20 @@ import UIKit
 			return layer.cornerRadius
 		}
 	}
+	
+	var parentViewController: ViewController? {
+		var parentResponder: UIResponder? = self
+		var i = 0
+		while parentResponder != nil {
+			print("UIVIEW:DEBUG: parentViewController level \(i)")
+			parentResponder = parentResponder!.next
+			if let viewController = parentResponder as? ViewController {
+				print("UIVIEW:DEBUG: parentViewController found  controller.")
+				return viewController
+			}
+		}
+		print("UIVIEW:DEBUG: parentViewController no controller found.")
+		return nil
+	}
+	
 }

+ 47 - 9
app/ViewController.swift

@@ -24,18 +24,22 @@ import CoreData
 /**
   The view controller of the app.
  */
-class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {
+class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UIGestureRecognizerDelegate {
+	
+	var delegate: AppDelegate?
 	
 	//The menu collection.
 	var sectionCollection: UICollectionView!
 
 	//Each of the sections of the app.
-	@IBOutlet weak var containerViewGallery: UIView!
-	@IBOutlet weak var containerViewBlog: UIView!
-	@IBOutlet weak var containerViewActivities: UIView!
-	@IBOutlet weak var containerViewLablanca: UIView!
-	@IBOutlet weak var containerViewLocation: UIView!
-	@IBOutlet weak var containerViewHome: HomeView!
+	@IBOutlet var containerViewGallery: GalleryView!
+	@IBOutlet var containerViewBlog: BlogView!
+	@IBOutlet var containerViewActivities: UIView!
+	@IBOutlet var containerViewLablanca: LablancaView!
+	@IBOutlet var containerViewLocation: UIView!
+	@IBOutlet var containerViewHome: HomeView!
+	
+	var passId: Int = -1
 	
 	func getContext () -> NSManagedObjectContext {
 		//let appDelegate = UIApplication.shared.delegate as! AppDelegate
@@ -43,6 +47,29 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 		return NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
 	}
 	
+	func showPost(id: Int){
+		print("CONTROLLER:DEBUG: Showing Post \(id)")
+		self.passId = id
+		performSegue(withIdentifier: "SeguePost", sender: nil)
+	}
+	
+	func showAlbum(id: Int){
+		NSLog(":CONTROLLER:DEBUG: Showing album \(id)")
+		self.passId = id
+		// TODO: Uncomment when ready
+		performSegue(withIdentifier: "SegueAlbum", sender: nil)
+	}
+	
+	override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
+		NSLog(":CONTROLLER:DEBUG: preparing for segue '\(segue.identifier)' with id \(self.passId)")
+		if segue.identifier == "SeguePost"{
+			(segue.destination as! PostViewController).id = passId
+		}
+		if segue.identifier == "SegueAlbum"{
+			(segue.destination as! AlbumViewController).id = passId
+		}
+	}
+	
 	/**
 	 Run when the app loads.
 	*/
@@ -54,12 +81,23 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 		self.containerViewActivities.alpha = 0
 		self.containerViewBlog.alpha = 0
 		self.containerViewGallery.alpha = 0
+		
+		
+		//self.containerViewBlog.isHidden = true
 				
-		print("ViewController:viewDidLoad()")
-		Sync()
+		print("CONTROLLER:LOG: viewDidLoad()")
+		print("CONTROLLER:DEBUG: Skyp sync")
+		//Sync()
 		
 		super.viewDidLoad()
 		// Do any additional setup after loading the view, typically from a nib.
+
+		
+		//self.containerViewBlog.setController(controller: self as ViewController)
+		
+		delegate = UIApplication.shared.delegate as! AppDelegate
+		delegate?.controller = self
+		
 	}
 
 	/**