Skip to content
This repository was archived by the owner on Nov 11, 2021. It is now read-only.

Commit

Permalink
Desktop app
Browse files Browse the repository at this point in the history
  • Loading branch information
rcotrina94 committed May 17, 2015
1 parent 3867d25 commit f265ceb
Show file tree
Hide file tree
Showing 15 changed files with 420 additions and 18 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ target/
*.db

# Node.js modules
platforms/desktop/src/node_modules
platforms/mobile/src/node_modeules
platforms/desktop/src/clients/admin/static/assets/components
# platforms/desktop/src/clients/admin/static/assets/components

# Platform builds
platforms/desktop/dist
platforms/mobiles/dist
# platforms/desktop/dist
# platforms/mobiles/dist
Empty file.
3 changes: 3 additions & 0 deletions platforms/desktop/src/clients/admin/.bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory" : "static/assets/components"
}
17 changes: 17 additions & 0 deletions platforms/desktop/src/clients/admin/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "angular-material-starter",
"description": "A starter project for AngularJS Material",
"version": "0.0.1",
"homepage": "https://github.com/angular/material-start",
"license": "MIT",
"private": true,
"dependencies": {
"angular": "master",
"angular-animate": "master",
"angular-aria": "master",
"angular-material": "master"
},
"devDependencies": {
"angular-material": "master"
}
}
50 changes: 50 additions & 0 deletions platforms/desktop/src/clients/admin/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
var app = require('app'); // Module to control application life.
var ipc = require('ipc');

var BrowserWindow = require('browser-window'); // Module to create native browser window.
var APP_DIR = 'file://' + __dirname;
var STATIC_DIR = APP_DIR + '/static/';

// Report crashes to our server.
require('crash-reporter').start();

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the javascript object is GCed.
var mainWindow = null;

// Quit when all windows are closed.
app.on('window-all-closed', function() {
if (process.platform != 'darwin'){
app.quit();
}
});

// This method will be called when Electron has done everything
// initialization and ready for creating browser windows.
app.on('ready', function() {
// Create the browser window.
mainWindow = new BrowserWindow({width: 640, height: 380, frame:false, show:false});

// and load the index.html of the app.
mainWindow.loadUrl(STATIC_DIR + 'login.html');

mainWindow.webContents.on('did-finish-load', function() {
mainWindow.show();
mainWindow.webContents.send('ping', 'whoooooooh!');
});

mainWindow.openDevTools();

// Emitted when the window is closed.
mainWindow.on('closed', function() {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});

ipc.on('window-evt', function(event, action) {
mainWindow[action]();
});

});
13 changes: 13 additions & 0 deletions platforms/desktop/src/clients/admin/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "citasalud.admin",
"version": "0.1.0",
"description": "(ADMIN) CitaSalud - Gestión de citas y diagnóstico",
"main": "main.js",
"scripts": {
"postinstall": "bower update"
},
"author": "Richard Cotrina <[email protected]>",
"license": "ISC",
"devDependencies": {},
"dependencies": {}
}
15 changes: 15 additions & 0 deletions platforms/desktop/src/clients/admin/static/assets/css/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
html, body {
font-family: 'Roboto', sans-serif;
font-size:14px;
height:100%;
margin: 0px;
padding: 0px;
}

body#login md-input-container.md-icon-float > md-icon {
top: 22px;
}

#login md-input-container.md-icon-float.md-input-focused, md-input-container.md-icon-float.md-input-has-value {
margin-top: -16px;
}
76 changes: 76 additions & 0 deletions platforms/desktop/src/clients/admin/static/assets/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
var app = angular.module('citaSalud', ['ngMaterial', 'users'])
.config(function($mdThemingProvider, $mdIconProvider){
$mdIconProvider
.iconSet("action", "assets/components/svg-material-icons/svg-sprite-action.svg", 24)
.iconSet("alert", "assets/components/svg-material-icons/svg-sprite-alert.svg", 24)
.iconSet("av", "assets/components/svg-material-icons/svg-sprite-av.svg", 24)
.iconSet("communication", "assets/components/svg-material-icons/svg-sprite-communication", 24)
.iconSet("content", "assets/components/svg-material-icons/svg-sprite-content.svg", 24)
.iconSet("device", "assets/components/svg-material-icons/svg-sprite-device.svg", 24)
.iconSet("editor", "assets/components/svg-material-icons/svg-sprite-editor.svg", 24)
.iconSet("file", "assets/components/svg-material-icons/svg-sprite-file.svg", 24)
.iconSet("hardware", "assets/components/svg-material-icons/svg-sprite-hardware.svg", 24)
.iconSet("image", "assets/components/svg-material-icons/svg-sprite-image.svg", 24)
.iconSet("maps", "assets/components/svg-material-icons/svg-sprite-maps.svg", 24)
.iconSet("navigation", "assets/components/svg-material-icons/svg-sprite-navigation.svg", 24)
.iconSet("notification", "assets/components/svg-material-icons/svg-sprite-notification.svg", 24)
.iconSet("social", "assets/components/svg-material-icons/svg-sprite-social", 24)
.iconSet("toggle", "assets/components/svg-material-icons/svg-sprite-toggle.svg", 24);

$mdThemingProvider.theme('default')
.primaryPalette('blue')
.accentPalette('blue-grey');
});

app.controller('mainCtrl', function($scope, $mdDialog){

var ipc = require('ipc');
var messenger = {
send : function(event, action) {
ipc.send(event, action);
}
};

$scope.loginData = {
'username' : 'admin',
'password' : 'admin',
'remember_pwd' : true
};

$scope.closeW = function(){
messenger.send('window-evt', 'close');
};
$scope.minW = function(){
messenger.send('window-evt', 'minimize');
$scope.hide();
};

$scope.doLogin = function(){
$scope.loading();
};

$scope.loading = function() {
var parentEl = angular.element(document.querySelector('#internalw'));
$mdDialog.show({
parent : parentEl,
controller: DialogController,
template: '<md-progress-circular class="md-accent" md-mode="indeterminate"></md-progress-circular>',
})
.then(function(answer) {
$scope.alert = 'You said the information was "' + answer + '".';
}, function() {
$scope.alert = 'You cancelled the dialog.';
});

};

function DialogController(scope, $mdDialog) {
scope.closeDialog = function() {
$mdDialog.hide();
}
}

$scope.hide = function(){
$mdDialog.cancel();
}
});
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
(function(){

angular
.module('users')
.controller('UserController', [
'userService', '$mdSidenav', '$mdBottomSheet', '$log', '$q',
UserController
]);

/**
* Main Controller for the Angular Material Starter App
* @param $scope
* @param $mdSidenav
* @param avatarsService
* @constructor
*/
function UserController( userService, $mdSidenav, $mdBottomSheet, $log, $q) {
var self = this;

self.selected = null;
self.users = [ ];
self.selectUser = selectUser;
self.toggleList = toggleUsersList;
self.share = share;

// Load all registered users

userService
.loadAllUsers()
.then( function( users ) {
self.users = [].concat(users);
self.selected = users[0];
});

// *********************************
// Internal methods
// *********************************

/**
* First hide the bottomsheet IF visible, then
* hide or Show the 'left' sideNav area
*/
function toggleUsersList() {
var pending = $mdBottomSheet.hide() || $q.when(true);

pending.then(function(){
$mdSidenav('left').toggle();
});
}

/**
* Select the current avatars
* @param menuId
*/
function selectUser ( user ) {
self.selected = angular.isNumber(user) ? $scope.users[user] : user;
self.toggleList();
}

/**
* Show the bottom sheet
*/
function share($event) {
var user = self.selected;

$mdBottomSheet.show({
parent: angular.element(document.getElementById('content')),
templateUrl: 'view/contactSheet.html',
controller: [ '$mdBottomSheet', UserSheetController],
controllerAs: "vm",
bindToController : true,
targetEvent: $event
}).then(function(clickedItem) {
clickedItem && $log.debug( clickedItem.name + ' clicked!');
});

/**
* Bottom Sheet controller for the Avatar Actions
*/
function UserSheetController( $mdBottomSheet ) {
this.user = user;
this.items = [
{ name: 'Phone' , icon: 'phone' , icon_url: './assets/svg/phone.svg'},
{ name: 'Twitter' , icon: 'twitter' , icon_url: './assets/svg/twitter.svg'},
{ name: 'Google+' , icon: 'google_plus' , icon_url: './assets/svg/google_plus.svg'},
{ name: 'Hangout' , icon: 'hangouts' , icon_url: './assets/svg/hangouts.svg'}
];
this.performAction = function(action) {
$mdBottomSheet.hide(action);
};
}
}

}

})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
(function(){
'use strict';

angular.module('users')
.service('userService', ['$q', UserService]);

/**
* Users DataService
* Uses embedded, hard-coded data model; acts asynchronously to simulate
* remote data service call(s).
*
* @returns {{loadAll: Function}}
* @constructor
*/
function UserService($q){
var users = [
{
name: 'Lia Lugo',
avatar: 'svg-1',
content: 'I love cheese, especially airedale queso. Cheese and biscuits halloumi cauliflower cheese cottage cheese swiss boursin fondue caerphilly. Cow port-salut camembert de normandie macaroni cheese feta who moved my cheese babybel boursin. Red leicester roquefort boursin squirty cheese jarlsberg blue castello caerphilly chalk and cheese. Lancashire.'
},
{
name: 'George Duke',
avatar: 'svg-2',
content: 'Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit​​, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris.'
},
{
name: 'Gener Delosreyes',
avatar: 'svg-3',
content: "Raw denim pour-over readymade Etsy Pitchfork. Four dollar toast pickled locavore bitters McSweeney's blog. Try-hard art party Shoreditch selfies. Odd Future butcher VHS, disrupt pop-up Thundercats chillwave vinyl jean shorts taxidermy master cleanse letterpress Wes Anderson mustache Helvetica. Schlitz bicycle rights chillwave irony lumberhungry Kickstarter next level sriracha typewriter Intelligentsia, migas kogi heirloom tousled. Disrupt 3 wolf moon lomo four loko. Pug mlkshk fanny pack literally hoodie bespoke, put a bird on it Marfa messenger bag kogi VHS."
},
{
name: 'Lawrence Ray',
avatar: 'svg-4',
content: 'Scratch the furniture spit up on light gray carpet instead of adjacent linoleum so eat a plant, kill a hand pelt around the house and up and down stairs chasing phantoms run in circles, or claw drapes. Always hungry pelt around the house and up and down stairs chasing phantoms.'
},
{
name: 'Ernesto Urbina',
avatar: 'svg-5',
content: 'Webtwo ipsum dolor sit amet, eskobo chumby doostang bebo. Bubbli greplin stypi prezi mzinga heroku wakoopa, shopify airbnb dogster dopplr gooru jumo, reddit plickers edmodo stypi zillow etsy.'
},
{
name: 'Gani Ferrer',
avatar: 'svg-6',
content: "Lebowski ipsum yeah? What do you think happens when you get rad? You turn in your library card? Get a new driver's license? Stop being awesome? Dolor sit amet, consectetur adipiscing elit praesent ac magna justo pellentesque ac lectus. You don't go out and make a living dressed like that in the middle of a weekday. Quis elit blandit fringilla a ut turpis praesent felis ligula, malesuada suscipit malesuada."
}
];

// Promise-based API
return {
loadAllUsers : function() {
// Simulate async nature of real remote calls
return $q.when(users);
}
};
}

})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(function(){
'use strict';

// Prepare the 'users' module for subsequent registration of controllers and delegates
angular.module('users', [ 'ngMaterial' ]);


})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<md-bottom-sheet class="md-list md-has-header">

<md-subheader>
Contact <span class="name">{{ vm.user.name }}</span>:
</md-subheader>

<md-list>
<md-item ng-repeat="item in vm.items">
<md-button ng-click="vm.performAction(item)">
<md-icon md-svg-icon="{{ item.icon_url }}"></md-icon>
{{item.name}}
</md-button>
</md-item>
</md-list>

</md-bottom-sheet>
Loading

0 comments on commit f265ceb

Please sign in to comment.