Рано или поздно каждый сайт нуждается в мобильной версии. Существует несколько способов реализации мобильной версии: адаптивный сайт, нативное приложение для iOS, Android etc.
В создании нативного приложения нам поможет отличная платформа под названием DrupalGap. DrupalGap - это платформа позволяющая создавать приложения для iOS и Android при помощи Drupal, PhoneGap, jQueryMobile, без непосредственного программирования на языке платформы.
DrupalGap. How to create native application for mobile devices based on Drupal site - DrupalCamp Donetsk 2014
1. 25 -27 April, 2014 http://camp2014.drupal.dn.ua
DrupalGap
Alexander Schedrov
How to create native application for mobile devices based on Drupal site
3. What is DrupalGap?
Mobile Application Development Kit for
Drupal Websites
DrupalGap Module is the connection
between mobile applications and Drupal
websites
(c)drupalgap.org
Let's take a look, if it's true!
4. Support
• Themes, modules
• Blocks
• Menus
• Pages
• Entities
• Fields
• Forms
• Views
• Messages
• Services
• Geolocation
• Other tools
5.
6. • You don't need a Objective-C and Java
developers
• For creating modules just need to write primitive
JS code
• Need to know how work Services
• Need to know how to create custom Services
endpoints and resources
To create powerful mobile application
7. How does PhoneGap work?
PhoneGap generates HTML, CSS
and JavaScript and make application
iOS and Android mobile
devices.
Apache Cordova provides access
via JavaScript to device
features such as the
Camera, GPS, File System,
Contacts, Compass, etc.
8. How mobile application interacts with Drupal Core
Services FTW!!!:)
Drupal site Application
9. Drupal requirements
services, rest_server, taxonomy, views_datasource,
views_json, drupalgap
!
Development environments
Google Chrome and the Ripple Emulator extension
OR
node.js
cordova
Java SDK for Android or xCode for iOS
14. Creating Menu
drupalgap.settings.menus['homepage_menu'] = {
links:[
{title:'News', path:'news'},
{title:'About', path:'node/1'},
{title:'Contact', path:'contact'},
{title:'Our team', path:'team'}
]
};
settings.js:
Important: here might be only real paths, not aliases
17. Using Views
Need to create page with JSON data document format
(views_json module)
Displaying a View in mobile app
function core_team_menu() {
var items = {};
items['team'] = {
title: 'Our team',
page_callback: 'core_team_page'
}
return items;
}
18. function core_team_page() {
var content = {};
content['team'] = {
theme: 'view',
format: ‘ul', /* ul, ol, table, unformatted_list */
path: 'mobile/team_new', /* the path to the view in Drupal */
row_callback: 'core_team_page_row',
empty_callback: 'core_team_page_empty',
attributes: {
id: 'team-view'
}
};
return content;
}
!
function core_team_page_row(view, row) {
var output = '';
output += '<img class="team-image" src="' + row.field_photo + '">';
output += l(row.title, 'node/' + row.Nid);
return output;
}
!
function core_team_page_empty(view) {
return 'Sorry, no results.';
}